help-bash
[Top][All Lists]
Advanced

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

[Help-bash] errexit and local var=$(cmd) broken?


From: Christoph Mathys
Subject: [Help-bash] errexit and local var=$(cmd) broken?
Date: Tue, 11 Aug 2015 12:46:51 +0200

I was surprised when I found that the following two statements behave
differently when run with set -o errexit. The statements are inside a
function.

# shell does not abort, even though errexit is set. Why not?
local var=$(false)

# shell does exit as I expect
local var
var=$(false)

I tried it in 4.3.11 and 4.2.25. Why is the behaviour as it is? It
seems non intuitive to me.

Christoph

PS Please CC as I'm not subscribed to the list.



reply via email to

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