[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Change in behaviour regarding subshell handling?
From: |
Martin Michlmayr |
Subject: |
Change in behaviour regarding subshell handling? |
Date: |
Wed, 23 Sep 2009 19:46:05 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
I noticed that bash has changed behaviour regarding subshell handling,
breaking a script of mine. Now a script with -e fails when a subshell
fails whereas it didn't before. I looked at the CHANGES file and
couldn't find anything about this, so I wanted to ask if this change
was intentional or if this is a bug.
In fact, there's something in CHANGES that might be relevant but the
description isn't really clear at all:
l. Changed behavior of shell when -e option is in effect to reflect consensus
of Posix shell standardization working group.
Anyway, the test program and output is below.
Take this script:
set -e
set -x
echo "1"
(echo "x" | grep -v "x")
echo "2"
On Debian lenny with 3.2.39(1)-release:
foobar:~# bash t
+ echo 1
1
+ grep -v x
+ echo x
+ echo 2
2
On Debian testing with 4.0.28(1)-release:
foobar:~# bash t
+ echo 1
1
+ echo x
+ grep -v x
With dash (same output for lenny and testing):
foobar:~# dash t
+ echo 1
1
+ echo x
+ grep -v x
+ echo 2
2
--
Martin Michlmayr
http://www.cyrius.com/
- Change in behaviour regarding subshell handling?,
Martin Michlmayr <=