[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] trap ERR in || with set -E enabled
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] trap ERR in || with set -E enabled |
Date: |
Wed, 5 Dec 2018 13:39:51 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 |
On 12/5/18 12:50 PM, Peng Yu wrote:
> Hi,
>
> I'd expect that `false` below is trapped independent from whether `f `
> is used with `||` or not. But it doesn't do so.
>
> The manual does not discuss the set -E case explicitly, but I think
> that it is better not to change the behavior of trap ERR in nonlocal
> places. Is this a design issue that worth reconsidering? Thanks.
The ERR trap fires in exactly the same circumstances where `set -e' would
cause the shell to exit. The converse is also true: it doesn't fire in the
cases where `set -e' has no effect. That is the primary design issue.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://tiswww.cwru.edu/~chet/