bug-bash
[Top][All Lists]
Advanced

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

Re: set -e in bash 4


From: Chet Ramey
Subject: Re: set -e in bash 4
Date: Wed, 21 Oct 2009 21:56:49 -0400
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Tobias Poschwatta wrote:
> In the following test case test1.sh, bash 4 behaves differently from
> bash 3.1. The behaviour of bash 3.1 is what I would expect to be
> correct.  Is this a bug in bash 4 or an intentional change?
> 
> Using bash 4:
> 
> $ /bin/bash --version
> GNU bash, version 4.0.28(1)-release (x86_64-pc-linux-gnu)
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> 
> This is free software; you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> $ ls
> test1a.sh  test1.sh  test2.sh
> $ cat test1.sh 
> ( set -e; . ./test2.sh ) || exit 1
> echo done
> $ cat test2.sh 
> echo 1
> false
> echo 2
> 
> $ cat test1a.sh 
> ( set -e; . ./test2.sh )
> echo done
> $ /bin/bash test1.sh 
> 1
> 2
> done
> $ /bin/bash test1a.sh 
> 1
> done

Yes, this is the intended behavior.  This is one of the things that
came out of the discussions among the Posix working group.  It also
matches historical practice.  Ironically, one of the examples we used
while discussing the issue is very close to yours.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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