What grail said, or use backticks / $() to get a command executed:
a=expr $sp - $cp
is going wrong; you saw this error:
Quote:
./10da: line 8: 89: command not found
|
which led to the next error; you were not assigning a proper value to the variable; and thus you get a "zero" variable-comparison which is being complained about.
You want to assign the value which is the outcome of the command; Hence, you need to tell the system that it is a command to be executed, like this:
a=`expr $sp - $cp` # using backticks
OR
a=$(expr $sp - $cp) # using $()
as a command execution; then you can do if [ $a -gt 0 ]