Hi Samuel,

I understand your problem, but I think bash is working the way it's
documentation says it should.  The bash manual page says:

"?      Expands to the status of the most recently executed foreground
pipeline."

and

"The return status of a pipeline is the exit  status  of  the  last
command,  unless  the pipefail  option is enabled."

The last command isn't the command farthest to the right -- it's the
last command to exit.  In your example,

> local BAR="$(false)"

the shell expands $(false) before it runs the local built-in, so the
last command is local.  Since local succeeded at lexically scoping your
variable, it returns true and completes the pipeline with a true value.

If you agree with this assessment, can you please close the bug?

Thank you,

-Dave

-- 
local assignment clobbers the return code
https://bugs.launchpad.net/bugs/304114
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to