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.

What I would expect to happen is ( set -e; echo foo; false; echo bar; ) ||
exit $? to exit with exit code of a last failed command in a subshell.

Reply via email to