bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set -e works incorrectly in subshells


From: Eric Blake
Subject: Re: set -e works incorrectly in subshells
Date: Wed, 23 Nov 2011 05:45:57 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

On 11/23/2011 03:26 AM, Марк Коренберг wrote:
> Repeat-By:
>       mmarkk@mmarkk-work:~$ ( set -e; echo aaa; false; echo bbb )
>       aaa
>       mmarkk@mmarkk-work:~$ ( set -e; echo aaa; false; echo bbb ) || true
>       aaa
>       bbb
>       mmarkk@mmarkk-work:~$

ksh has the same behavior, and POSIX requires it (basically, running the
subshell on the left of || has a higher precedence than the explicit
'set -e' within the subshell).

http://austingroupbugs.net/view.php?id=52

Expected behavior.  And one of the arguments I give why using the crutch
of 'set -e' is almost always the wrong thing in a complex script.

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]