It's not specified which shell is interpereting this script... From error code I assume it's ksh...
From the error message, I presume that the problem is that after then
, else
, do
, ksh does not accept a ;
.
However, just out of curiosity, I did just install ksh on my linux box. It's at version "93u+ 2012-08-01". Your script runs just fine, no syntax errors, here... Probably you are running a different (possibly older) version of the shell, or a different shell at all... You should definitely specify which shell you're using... :-).