Set -e is ignored in a subshell followed by a conditional statement

I can not find documentation indicating that this is the correct behavior. I tested this behavior on bash 4.2.25 and 4.1.2. These are the last ones to which I have easy access. It is very important if someone explains why the conditional change in the behavior of the previous subshell.

# ( set -e; false ; echo bye )
# ( set -e; false ; echo bye ) || echo "failed"
bye
#

thanks Brian

+4
source share
2 answers

See link

-e           , , , , elif ,           , !            AND-OR, .

+2

, -e bash 4.2 man:

,                       , , - [...] ,                       a & || [...]

false , LHS ||, , , -e . , , false || , set -e .

+2

Source: https://habr.com/ru/post/1542390/


All Articles