gnu.bash.bug
[Top] [All Lists]

Re: (set -u -e; trap true EXIT; echo $bad) exits 0

Subject: Re: (set -u -e; trap true EXIT; echo $bad) exits 0
From: Freddy Vulto
Date: Fri, 10 Apr 2009 23:47:06 +0200
Newsgroups: gnu.bash.bug

Even within the EXIT trap, the -u error exit status disappears when -e
is used (?):

$ (set -u; trap 'echo $?' EXIT; echo $bad)
bash: bad: unbound variable
1
$ (set -eu; trap 'echo $?' EXIT; echo $bad)
bash: bad: unbound variable
0

Freddy Vulto
http://fvue.nl



<Prev in Thread] Current Thread [Next in Thread>