On Mon, Oct 07, 2013 at 11:58:48AM -0300, Carlos Pita wrote: > > Exiting in a subshell will never cause the parent shell to exit, > > regardless of depth. > > This is not true in general. > set -e; (exit 1); echo "I don't exist"
In this case, it is the "set -e" which may or may not cause the parent shell to terminate, depending on which shell you're doing this in. imadev:~$ bash-4.3 -c 'set -e; (exit 1); echo "I do not exist"' imadev:~$ bash-4.2 -c 'set -e; (exit 1); echo "I do not exist"' imadev:~$ bash-4.1 -c 'set -e; (exit 1); echo "I do not exist"' imadev:~$ bash-4.0 -c 'set -e; (exit 1); echo "I do not exist"' imadev:~$ bash-3.2 -c 'set -e; (exit 1); echo "I do not exist"' I do not exist The exit itself is *not* propagated upward, and please see my previous comments about the reliability and usefulness of set -e (i.e. none).