Re: Command substitution and exiting from deeply nested subshells

2013-10-07 Thread Greg Wooledge
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 pare

Re: Command substitution and exiting from deeply nested subshells

2013-10-07 Thread Carlos Pita
> $(xxx) is a word expansion, not a command. Bash will only pay attention to > the exit status of command substitution in one case (x=$(foo)). This > command substitution doesn't contribute to any other command's exit status, > especially `echo', and `set -e' doesn't cause the shell to pay attent

Re: Command substitution and exiting from deeply nested subshells

2013-10-07 Thread Chet Ramey
On 10/6/13 8:37 PM, Carlos Pita wrote: > I'm not completely sure whether this is a bug or not but it seems > not possible to immediately exit a shell when an error happens at 2+ > levels of subshell nesting. Specifically, there is a command at the > top-level shell waiting for the results of a

Re: Command substitution and exiting from deeply nested subshells

2013-10-07 Thread Greg Wooledge
On Sun, Oct 06, 2013 at 09:37:00PM -0300, Carlos Pita wrote: > I'm not completely sure whether this is a bug or not but it seems > not possible to immediately exit a shell when an error happens at 2+ > levels of subshell nesting. Exiting in a subshell will never cause the parent shell to exit, r