[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
set -e in bash 4
From: |
Tobias Poschwatta |
Subject: |
set -e in bash 4 |
Date: |
Tue, 20 Oct 2009 16:51:59 +0200 |
User-agent: |
Mutt/1.4.2.2i |
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
Using bash 3.1.17:
$ /bin/bash --version
GNU bash, version 3.1.17(2)-release (i486-slackware-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
$ /bin/bash test1.sh
1
$ /bin/bash test1a.sh
1
done
Thanks,
Tobias
- set -e in bash 4,
Tobias Poschwatta <=