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


Groups > gnu.bash.bug > #16311

Re: local failure

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: local failure
Date 2020-05-28 10:21 -0400
Message-ID <mailman.538.1590675705.2541.bug-bash@gnu.org> (permalink)
References <CAH+roKWmQLjDGf_UpDabq6AHN+CVF_bKd1uyO2d8EadXzJ72MA@mail.gmail.com> <20200528142112.GY4133@eeg.ccf.org>

Show all headers | View raw


On Thu, May 28, 2020 at 08:02:18AM +0100, Laurent Picquet wrote:
> function aFunction {
>     local aVar="$(somethingThatFails)" || { echo "is expected to go there";
> return 1; }
> }

"local" is a command with its own separate exit status.  It masks
the exit status of the command substitution.

Run the two commands separately.

local aVar
aVar=$(foo) || diestuff

https://mywiki.wooledge.org/BashPitfalls#pf27

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


Thread

Re: local failure Greg Wooledge <wooledg@eeg.ccf.org> - 2020-05-28 10:21 -0400

csiph-web