[ale] exit code and if

Byron A Jeff byron at cc.gatech.edu
Thu Jul 18 11:10:26 EDT 2002


> 
> Hello ALE,
> as always simple question and looking for Your suggestions:
> 
> cmd
> if [ $? -ne 0 ]; then <do smth> fi
> 
> Is there a better way to this? 

Absolutely!

>I mean how i can get rid from this 2 lines and make one ?

Try this:

cmd || <do smth>

the line 'cmd || error' says to execute error if and only if cmd returns a
non zero status.

BAJ

---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list