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


Groups > gnu.bash.bug > #16314

Re: local failure

From worley@alum.mit.edu (Dale R. Worley)
Newsgroups gnu.bash.bug
Subject Re: local failure
Date 2020-05-28 22:43 -0400
Message-ID <mailman.580.1590720241.2541.bug-bash@gnu.org> (permalink)
References <CAH+roKWmQLjDGf_UpDabq6AHN+CVF_bKd1uyO2d8EadXzJ72MA@mail.gmail.com> <87tuzzh34x.fsf@hobgoblin.ariadne.com>

Show all headers | View raw


It's a subtle point.  See this paragraph in the bash manual page:

       If there is a command name left after expansion, execution
       proceeds as described below.  Otherwise, the command exits.  If
       one of the expansions contained a command substitution, the exit
       status of the command is the exit status of the last command
       substitution performed.  If there were no command substitutions,
       the command exits with a status of zero.

In one of your examples, a "local" command is generated using a command
substitution, so the exit status is that of the local command.  In the
other, only an assignment is done, which is not a command, so the exit
status is that of the last command substitution.

Dale

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


Thread

Re: local failure worley@alum.mit.edu (Dale R. Worley) - 2020-05-28 22:43 -0400

csiph-web