Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: check exit code
- X-seq: zsh-users 11655
- From: sac <sac_urs@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: check exit code
- Date: Wed, 18 Jul 2007 03:25:48 -0700 (PDT)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=zdKEyg/9PZc2F9L1w5IyJKJ8hiv1Ogco3tuL22JC7d7Ah0RUYke4v+cnOCSqDLCMxEPgqVEGuqOwl0tz+sPJIxvbh29lbNu33jf5q2KUpupjn0bE+2FsnoT2GI9hGqcfaWigCVbb8Ew5LREOzmY4EUtL69UYQ44AS6bZFlPWYnk=;
- In-reply-to: <20070718095930.GA4936@crematorium>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
--- 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