Hi there. I'm new to scripting in bash shell and I have this problem.
I'm trying to make a script that returns the greatest common divisor of two integer numbers according to Euclid's algorithm...
Here is, what I've done:
#!/bin/bash
m=$1
n=$2
while [ "$n" != 0 ]
do
if [ "$m" -gt "$n" ]; #line 8
then m=$m-$n
else n=$n-$m
fi
done
echo $n
and I get an error message: line 8:integer exrpession expected
I run the gcd.sh writing in the terminal
./gcd.sh 14 28
where 14 and 28 are integers, right?
So, what's the problem? Could you please tell me what should I write?