bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command substitution and exiting from deeply nested subshells


From: Carlos Pita
Subject: Re: Command substitution and exiting from deeply nested subshells
Date: Mon, 7 Oct 2013 11:58:48 -0300

> $(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 attention
> to it.

Thanks Chet, it's clear now.

> 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"

>> I've tested this with set -e, set -E, an ERR trap,
> All of those are useless and should be avoided.

Ok, I'm not particularly interested in using them, I was just
reinforcing my point.

Best regards
--
Carlos



reply via email to

[Prev in Thread] Current Thread [Next in Thread]