Piotr Zielinski wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i486 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' > -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' > -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include > -I../bash/lib -g -O2 -Wall > uname output: Linux pzlaptop 2.6.22-gg15-generic #1 SMP Fri Sep 26 > 12:50:35 EST 2008 i686 GNU/Linux > Machine Type: i486-pc-linux-gnu > > Bash Version: 3.2 > Patch Level: 25 > Release Status: release > > Description: > The following command > > $ (set -u -e; trap true EXIT; echo $bad;) && echo OK > > displays > > bash: bad: unbound variable > OK > > I'd think it should exits with a non-zero error code and not > display OK. This is exacly what happens if you remove -e.
Thanks for the report. The problem is that bash doesn't always set $? before testing whether or not the shell should exit because -e has been set and an unset variable is being expanded. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/