bug-bash
[Top][All Lists]
Advanced

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

Trap on ERR not inherited by subshell with "set -E"


From: Markus Laire
Subject: Trap on ERR not inherited by subshell with "set -E"
Date: Wed, 1 Mar 2006 10:20:46 +0200

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-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
uname output: Linux Knoppix 2.6.12 #2 SMP Tue Aug 9 23:20:52 CEST 2005
i686 GNU/Linux
Machine Type: i386-pc-linux-gnu

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:
        Bash manpage says that if "set -E" is set,
          "any trap on ERR is inherited by shell functions, command 
substitutions,
          and commands executed in a subshell environment. The ERR trap is
          normally not inherited in such cases."
        But when running this script
          trap 'echo ERR'  ERR
          set -E
          echo "Fail in this shell"
          false
          ( echo "Fail in subshell" ; false )
        Only first 'false' is trapped, and the 'false' in subshell is not 
trapped.      

Repeat-By:
        Repeat by running this shell-script.
          trap 'echo ERR'  ERR
          set -E
          echo "Fail in this shell"
          false
          ( echo "Fail in subshell" ; false )




reply via email to

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