On Tue, Sep 22, 2015 at 10:19:56AM -0400, idal...@home.idallen.ca wrote:
> Description:
>       Adding a "local" keyword to a variable assignment hides the
>       return code of a command substitution.  Same problem in both
>       bash and dash shells.

Yes, this is how it works.  If you care about the return value of a
command used to initialize a local variable, you have to write it in
two steps:

foo() {
    local foo
    foo=$(bar) || return
}

http://mywiki.wooledge.org/BashPitfalls has this and many more.

Reply via email to