On Tue, Jun 02, 2020 at 09:44:45PM -0400, Dale R. Worley wrote:
> Naively, I expect that
> FOO="$( command2 )"
> command1 "$FOO"
>
> has the same effect as
>
> command1 "$( command2 )"
>
> Has anyone pushed the boundaries of this and can tell me whether there
> are gotchas?
The main case where people care about the difference is when set -e is
in effect. Otherwise, no, most people do not care. If they cared, they
would be checking the exit status of command2 themselves, rather than
simply letting the shell proceed.
(And set -e should never be in effect. But people don't listen when we
tell them that, so that situation persists.)