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


Groups > gnu.bash.bug > #11337 > unrolled thread

Re: -e does not take effects in subshell

Started byEric Blake <eblake@redhat.com>
First post2015-08-12 23:09 -0600
Last post2015-08-12 23:09 -0600
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#11337 — Re: -e does not take effects in subshell

FromEric Blake <eblake@redhat.com>
Date2015-08-12 23:09 -0600
SubjectRe: -e does not take effects in subshell
Message-ID<mailman.8234.1439442606.904.bug-bash@gnu.org>

[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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web