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

Reply via email to