On 10/7/13 5:01 AM, Bartłomiej Palmowski wrote: > Hi, > > lets consider the following: > > $ echo $BASH_VERSION > 4.1.2(1)-release > $ cat /etc/system-release > Red Hat Enterprise Linux Server release 6.3 (Santiago) > $ ( set -e; echo foo; false; echo bar; ) # this one is expected > foo > $ ( set -e; echo foo; false; echo bar; ) || true # this one is not expected > foo > bar > > documentation (http://www.gnu.org/software/bash/manual/bash.html) states > that: > > [...] The shell does not exit if the command that fails is part of the > command list immediately following a while or until keyword, part of the > test in an if statement, part of any command executed in a && or || [...] > > In this case it is not clear since set -e is invoked inside subshell and || > is outside this subshell.
The subshell command is clearly part of the || compound command. The subshell `knows' that it is part of || and set -e has no effect. This example has been discussed before, on this list and the austin-group Posix list, and the bash behavior is correct. 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/