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

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

 



On Sun, Nov 10, 2024, at 1:08 AM, Christoph Anton Mitterer wrote:
> 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
> $

Bash does NOT ignore "set -e" here; it just sets "set +e" in the
command substitution subshell.  You can see this by reenabling
"set -e" inside:

	$ ./bash -ec 'echo "$(set -e; echo a; false; echo b)"'
	a

Compare with a context in which it actually does ignore "set -e":

	$ ./bash -ec '! echo "$(set -e; echo a; false; echo b)"'
	a
	b

-- 
vq




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

  Powered by Linux