Re: Case of set -e not being in effect in a subshell.
From:
Chet Ramey
Subject:
Re: Case of set -e not being in effect in a subshell.
Date:
Mon, 11 Jun 2018 11:09:17 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
On 6/11/18 6:12 AM, Bartłomiej Palmowski wrote:
>
> The issue is:
> $ cat bad
> (
> set -e
> false
> echo "Shouldn't happen?"
> ) && :
> $ bash ./bad ; echo $?
> Shouldn't happen?
> 0
`set -e' is ignored for any command of an OR list except the last, whether
it is in effect before the command is executed or when enabled by the
command itself.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/