ksh[139]: syntax error at line 822 : `then' unmatched