Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: check exit code



--- Roman Cheplyaka <roma@xxxxxxxxxxx> wrote:

> I want to check exit code of some command through
> the $? variable
> (putting command into 'if' statement is not
> acceptable).
> I found currently two ways to do so:
> if (( $? == 0 )); then; echo true; else; echo false;
> fi
> if  ( exit $? ) ; then; echo true; else; echo false;
> fi
> 
> Neither of them seems to be elegant. Maybe there is
> a builtin which takes
> number as argument and returns it? Or what would you
> suggest?
> 

use,

if [ $? -eq 0 ]; then; echo "ture"; fi




      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 




Messages sorted by: Reverse Date, Date, Thread, Author