Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11337

Re: -e does not take effects in subshell

Path csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail
From Eric Blake <eblake@redhat.com>
Newsgroups gnu.bash.bug
Subject Re: -e does not take effects in subshell
Date Wed, 12 Aug 2015 23:09:59 -0600
Organization Red Hat, Inc.
Lines 47
Approved bug-bash@gnu.org
Message-ID <mailman.8234.1439442606.904.bug-bash@gnu.org> (permalink)
References <BLU176-W28809FB59FF9274B34D871D67F0@phx.gbl> <20150811135056.GD4309@eeg.ccf.org> <BLU176-W27103575D91F4EF315336FD67D0@phx.gbl>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LA32DePxlVLtB5OREf6dhTM10iI3KNt7I"
X-Trace usenet.stanford.edu 1439442607 6053 208.118.235.17 (13 Aug 2015 05:10:07 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bug-bash@gnu.org" <bug-bash@gnu.org>
To PRC <ijkxyz@msn.com>, Greg Wooledge <wooledg@eeg.ccf.org>
Envelope-to bug-bash@gnu.org
Openpgp url=http://people.redhat.com/eblake/eblake.gpg
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
In-Reply-To <BLU176-W27103575D91F4EF315336FD67D0@phx.gbl>
X-Scanned-By MIMEDefang 2.68 on 10.5.11.27
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x
X-Received-From 209.132.183.28
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11337

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 08/12/2015 09:54 PM, PRC wrote:
> 1.  If the function is complicated and contains lots of commands, it 
> would be more troublesome appending && to every command rather 
> than simply using one single "set -e" at the front.
> 2.  It is not 
> reasonable that suppression of '-e' is applied as well inside the 
> function. My intention is if my_build succeeds continue to do other 
> stuff. Does anyone like the rule that a function never fails only if it is part of a 
> compound command?

Like it or not, it is the historical behavior standardized by POSIX. It
is NOT intuitive, and our advice is "DON'T USE set -e - IT WON'T DO WHAT
YOU WANT".  We can't change the behavior, because it would break scripts
that rely on the POSIX-specified behavior.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: -e does not take effects in subshell Eric Blake <eblake@redhat.com> - 2015-08-12 23:09 -0600

csiph-web