Marcin Owsiany wrote:

> I expected that if a simple pipeline failure causes the shell to exit, and a 
> simple for loop failure causes it to exit, then a failure in their 
> combination would also cause an exit. However it is not so.

You've found a probable bug, but it's not where you think.  Each element
of a pipeline is run in a separate execution environment and a separate
process.  Even if the child process inherits the errexit flag, the fact
that false returns failure should not affect the parent shell: a pipeline
is not a simple command.  You can see this by adding another process to
the pipeline:

set -e
true | false | echo final
echo after

In all cases, `final' and `after' are both displayed.

This bug only occurs when errexit is enabled and the final element of a
pipeline is a simple command that returns a non-zero exit status.  I will
devise a fix for the next bash release.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


Reply via email to