gcd.sh script doesn't work...

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?

I may be wrong but I do not believe that you are using a valid
algorithm. Try the following.

#!/bin/bash

m=$1         # dividend
n=$2          # divisor
r=1            # remainder

until [ $r == 0 ]
do
   let "r =$m % $n"
   m=$n
   n=$r
done

echo "The GCD of $1 and $2 is $m"