Hi Baosheng,
Just for the record, the problem was given by the expression evaluator "expr" detected a syntax error; you wrote the expression as
instead of
Code:
num=`expr $num + 1`
As the expression evaluator received just 2 arguments, it gave a syntax error, returning an empty string to "num" variable.
As this variable is not numeric anymore, the test operator "[" returns an error as it is comparing a non numeric variable using the numeric comparator "-lt".