bug-bash
[Top][All Lists]
Advanced

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

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


From: Piotr Zielinski
Subject: (set -u -e; trap true EXIT; echo $bad) exits 0
Date: Thu, 9 Apr 2009 18:46:51 +0100

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.

        I'm not sure whether this is of any use, but in the outputs
        below, we have '++ true' in the first case, and '+ true' in
        the other.

        $ (set -x -u -e; trap true EXIT; echo $bad;)
        + trap true EXIT
        bash: bad: unbound variable
        ++ true

        $ (set -x -u; trap true EXIT; echo $bad;)
        + trap true EXIT
        bash: bad: unbound variable
        + true



Repeat-By:

        Execute the above command.




reply via email to

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