Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16360

Re: Command substitution

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Command substitution
Date 2020-06-03 07:19 -0400
Message-ID <mailman.1050.1591183196.2541.bug-bash@gnu.org> (permalink)
References <87mu5kgbxu.fsf@hobgoblin.ariadne.com> <20200603111922.GY4133@eeg.ccf.org>

Show all headers | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Command substitution Greg Wooledge <wooledg@eeg.ccf.org> - 2020-06-03 07:19 -0400

csiph-web