syntax error in while loop

Hi,

I have the following script (compile_mercury) and I get this error: I have no idea why...and I have written this script completely in linux (bash) and not in windows.

****************
./compile_mercury: line 136: syntax error near unexpected token `done'
./compile_mercury: line 136: `done'
****************

Here is the script. Line 136 is the second 'done' statement.

************
semi=2
while [ $semi -le 7 ]
semi2=0
while [ $semi2 -le 90 ]
e=1
while [ $e -le 12 ]
do
.....
....
e=`expr $e + 1`
done
semi2=`expr $semi2 + 10`
done
semi=`expr $semi + 1`
done
***************
Thanks

Without seeing the whole script, it's very hard to say. It's not uncommon for this error message to be caused by a quoting problem somewhere pretty far from the line indicated by the error message; if a misplaced quote hides a "fi" from the shell, it will still be looking for it when it gets to a "done" much later, and complain about the "done". (You seem to be missing a "do" after "while [ $semi2 -le 90 ]"; perhaps this is related.)

I hope you have indentation in your actual script to show the structure, especially if it's that long. You might want to use code tags when posting code snippets in the future.