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

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

 



On 10/11/2024 06:08, Christoph Anton Mitterer wrote:
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?

I think you're right that POSIX specifies the behaviour.

I think Herbert Xu is also right not to want to make changes here.

The reason why bash by default behaves contrary to what POSIX specifies is that what POSIX specifies is not useful. In command substitutions, ignoring set -e in the way that you are asking for is even less useful.

Ignore what POSIX specifies for a moment. Is there any situation where the behaviour you are asking for is what someone who writes 'set -e' would want? Is there a real use case that would be helped by making this change? If there is, I am not seeing it.

Cheers,
Harald van Dijk




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

  Powered by Linux