[Top][All Lists]

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

Issues with set -e and subshell

From: Mario TRENTINI
Subject: Issues with set -e and subshell
Date: Thu, 29 Oct 2009 19:22:33 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

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 touchndie 2.6.18v1 #1 SMP Thu Sep 21 10:01:41 CEST 2006     
i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description: Using set -e with subshell gives unexpected results



First issue :

# The following works fine : end is displayed
( set -e ; echo Start ; false ; echo end )

# The following works in a different way : end is not displayed
( set -e ; echo Start ; false ; echo end ) || echo ERROR

# note that Bash 4 has the same behavior
# (GNU bash, version 4.0.28(1)-release)

Is it a bug or the expected behavior, if it is a bug, is there a workaround ?

Second issue :

# I expect the following to not display status but to exit the shell :
set -e ; ( exit 1 ) ; echo status $?

# I observed the expected behavior on Bash 4.

Is there a way for Bash 3 to have the same behavior as Bash 4 ?

Thanks in advance.

Best regards


reply via email to

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