[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -e does not take effects in subshell
From: |
Eric Blake |
Subject: |
Re: -e does not take effects in subshell |
Date: |
Wed, 12 Aug 2015 23:09:59 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
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
signature.asc
Description: OpenPGP digital signature
- -e does not take effects in subshell, PRC, 2015/08/11
- Re: -e does not take effects in subshell, Greg Wooledge, 2015/08/11
- Re: -e does not take effects in subshell, Andreas Schwab, 2015/08/18
- Re: -e does not take effects in subshell, Linda Walsh, 2015/08/18
- Re: -e does not take effects in subshell, Greg Wooledge, 2015/08/20
- Re: -e does not take effects in subshell, Linda Walsh, 2015/08/20
- Re: -e does not take effects in subshell, Chet Ramey, 2015/08/20