[Top][All Lists]

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

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

From: Chet Ramey
Subject: Re: Trap on ERR not inherited by subshell with "set -E"
Date: Sun, 05 Mar 2006 17:14:15 -0500
User-agent: Thunderbird 1.5 (Macintosh/20051201)

Markus Laire wrote:
> 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.      

Thanks.  This will be fixed in the next version.

``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                           Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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