That would not necessarily lead to syntax errors. These are because the parameters are unset/empty. Try double quoting them whatever they are: $(expr "$t1" + "$t2") .
If $t1 , $t2 , $t3 , and $t4 expand to integer values, any shell that recognizes:
if [[ `expr $t1 + $t2` == `expr $t3 + $t4` ]]; then
should also be able to perform arithmetic expansions (which are shell built-ins) instead of invoking the expr utility twice. Try changing the above line to:
if [[ $(($t1 + $t2)) == $(($t3 + $t4)) ]]; then
If you're using a 1993 or later version of ksh , this will also work if those variables expand to floating point values.
Even if your shell doesn't support arithmetic expansions or if you're dealing with floating point values and you aren't using a recent ksh , you could get rid of one invocation of expr using:
if [[ `expr $t1 + $t2 - $t3 - $t4` == 0 ]]; then
or, preferably, the non-obsolescent form:
if [[ $(expr $t1 + $t2 - $t3 - $t4) == 0 ]]; then
If you'd show us some sample contents of your node*.txt files, we can probably also help you replace your four grep and cut pipelines with something faster.