bug-bash
[Top][All Lists]
Advanced

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

Re: Command substitution


From: Greg Wooledge
Subject: Re: Command substitution
Date: Wed, 3 Jun 2020 07:19:22 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

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.)



reply via email to

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