Re: set -e not ignored in AND-OR list

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

 



On Sun, 2024-11-10 at 12:11 +0800, Herbert Xu wrote:
> This is simply undefined behaviour.

Are you sure that this is undefined? Cause:

> The -e setting shall be ignored when executing the compound list
> following the while, until, if, or elif reserved word, a pipeline
> beginning with the ! reserved word, or any command of an AND-OR list
> other than the last.

... seems to define just that.

Or do you know of any part in the standard that allows an exception
from this?



> Some shells will ignore set -e
> within the command substitution subshell as a result of the ||, some
> won't.  Dash does the latter.

I know that bash ignores set -e per default in the standard (which I
think is however NOT POSIX compliant either), e.g.

bash without --posix:
$ set -e 
$ echo "$(echo a; false; echo b)"
a
b
$

But bash with --posix:
$ bash --posix
bash-5.2$ set -e 
bash-5.2$ echo "$(echo a; false; echo b)"
a
bash-5.2$ 


Cheers,
Chris.





[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux