bug-bash
[Top][All Lists]
Advanced

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

Re: local failure


From: Greg Wooledge
Subject: Re: local failure
Date: Thu, 28 May 2020 10:21:12 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

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

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