bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why sh does not return a false value?


From: Andreas Schwab
Subject: Re: Why sh does not return a false value?
Date: Sat, 05 Feb 2011 16:26:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.93 (gnu/linux)

ali hagigat <address@hidden> writes:

> if (sh -c exit 34) then echo ppppppppp;fi
> ppppppppp
> The following condition should be false, because our exit value is
> non-zero.

No, it isn't.  You are executing the exit command without an argument,
so it uses the exit status of the last command.  Since there was no
preceding command the exit status is zero.  The extra argument is simply
ignored.

Andreas.

-- 
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]