bug-bash
[Top][All Lists]
Advanced

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

Re: Bash4: Problem retrieving "$?" when running with "-e"


From: Chet Ramey
Subject: Re: Bash4: Problem retrieving "$?" when running with "-e"
Date: Fri, 12 Apr 2013 11:15:56 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

On 4/12/13 7:44 AM, Lenga, Yair wrote:

> The man page says that '-e' will "exit immediately if a simple command (note 
> Simple Command::) exits with non-zero status unless ...".
> The "simple commands" definition is a "sequence of words separate by blanks 
> ...". According to this definition, the sequence "( simple command )" 
> Is NOT a simple command, and should NOT  trigger the "immediate exit".
> 
> Can anyone comment on my interpretation. Is there alternative solution that 
> will allow retrieval of the status of single commands when running
> With the '-e' ?

You appear to be using bash-4.x and reading the bash-3.x manual page.

The bash-4.0 man page says

Exit immediately if a \fIpipeline\fP (which may consist of a single
\fIsimple command\fP),  a \fIsubshell\fP command enclosed in parentheses,
or one of the commands executed as part of a command list enclosed
by braces (see
.SM
.B SHELL GRAMMAR
above) exits with a non-zero status.

The same language is in the man page through bash-4.2.

There has been extensive discussion of the changes to -e between bash-3.2
and bash-4.0, which brought bash closer to Posix.  Bash wasn't totally
Posix-conformant until bash-4.2.

See http://lists.gnu.org/archive/html/bug-bash/2012-12/msg00102.html for
a summary.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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