On 1/24/12 4:53 AM, Jim Avera wrote: > Bash Version: 4.2 > Patch Level: 10 > Release Status: release > > Description: > set -e in (subshells) should be independent of surrounding context. > The man page says "[set -e] applies to the shell environment and > each subshell environment separately", > but actually set -e is prevented from working in a (subshell) if it is > disabled in the > surrounding context.
That sentence is cribbed from the Posix description, and means that if the -e setting is active in a subshell, it affects whether or not that subshell exits on command failure, but the outer shell may or may not exit depending on its context. The Posix example is set -e; (false; echo one) | cat; echo two where the subshell inherits set -e because it's not in a place where it's ignored, and exits due to the `false' failing, but does not affect the exit status of the pipeline. The failure of the subshell does not imply the failure of the pipeline. As Eric said, the other parts of the Posix description make it clear that the `ignoring set -e' status is inherited by subshells. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/