Re: local assigned from command substitution disobeys set -eu

2014-12-30 Thread Ville Oikarinen
> Cool, another one to add to the wiki page! I am always excited by new > weapons in the never-ending war against set -e. > > This particular issue was also already noted in a more general context on > http://mywiki.wooledge.org/BashPitfalls -- see entry #27. Ah, so there is a "workaround", thank

Re: local assigned from command substitution disobeys set -eu

2014-12-30 Thread Chet Ramey
On 12/30/14 7:03 AM, Ville Oikarinen wrote: > Hello. > > I often use "set -eu" to make my scripts more robust by exiting when > there are errors. > > But one of my scripts just kept on running after failures. I found out > that the keyword "local" does not obey it. Here is a script to > reproduce

Re: local assigned from command substitution disobeys set -eu

2014-12-30 Thread Greg Wooledge
On Tue, Dec 30, 2014 at 02:03:01PM +0200, Ville Oikarinen wrote: > I often use "set -eu" to make my scripts more robust by exiting when > there are errors. http://mywiki.wooledge.org/BashFAQ/105 > But one of my scripts just kept on running after failures. I found out > that the keyword "local" do

local assigned from command substitution disobeys set -eu

2014-12-30 Thread Ville Oikarinen
Hello. I often use "set -eu" to make my scripts more robust by exiting when there are errors. But one of my scripts just kept on running after failures. I found out that the keyword "local" does not obey it. Here is a script to reproduce the problem: #!/bin/bash set -eu failure() { echo "g