bug-bash
[Top][All Lists]
Advanced

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

Re: -e does not work with subscript


From: Stepan Koltsov
Subject: Re: -e does not work with subscript
Date: Tue, 29 Jan 2008 11:04:49 +0300

On 1/29/08, Pierre Gaston <address@hidden> wrote:
> On Jan 28, 2008 11:36 PM,  <address@hidden> 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
> > uname output: Linux hilbert 2.6.18-openvz-amd64 #1 SMP Tue Apr 10 19:34:07 
> > MSD 2007 i686 GNU/Linux
> > Machine Type: i486-pc-linux-gnu
> >
> > Bash Version: 3.1
> > Patch Level: 17
> > Release Status: release
> >
> > Description:
> >         failed subscript does not cause script to exit, while -e is set
> >
> > Repeat-By:
> >
> >         % cat aa.sh
> >         set -e
> >
> >         (
> >             false
> >         )
> >
> >         echo "unreachable"
> >
> >         % bash ./aa.sh
> >         unreachable
> >         % zsh ./aa.sh
> >         zsh: exit 1     zsh ./aa.sh
> >
> >         Script aa.sh is expected to exit with error and print nothing. In 
> > bash it prints "unreachable".
> >
> >
> bash exits the subshell you create with ( )  and not the shell:
>
> $ bash -ce '(false;echo foo);echo bar'
> bar

Bash must exit the shell too. Because

$ bash -ce '(false); echo $?'
1

S.




reply via email to

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