$ if [ "$TERM" = 'xterm' ]; then echo aaa; fi aaa
— ok
l(){ if [ "$TERM" = 'xterm' ]; then echo aaa; fi }
— syntax error near unexpected token `}'
l(){ if [ "$TERM" = 'xterm' ]; then echo aaa; fi }
— ok
l(){ if [ "$TERM" = 'xterm' ]; then echo aaa; fi }
— syntax error near unexpected token `}'
l(){ if [ "$TERM" = 'xterm' ]; then echo aaa; fi }
— ok
l(){ if [ "$TERM" = 'xterm' ]; then echo aaa; fi; }
— ok
# return the status of last executed command return $? # 0: success, others: failure
e.g.:
grep ... return $? # 0: found, 1:no found