bug-bash
[Top][All Lists]
Advanced

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

Re: use of set -e inside parenthesis and conditionnal second command


From: Léa Gris
Subject: Re: use of set -e inside parenthesis and conditionnal second command
Date: Tue, 17 Nov 2020 16:55:44 +0100
User-agent: Telnet/1.0 [tlh] (PDP11/DEC)

On 17/11/2020 at 16:00, Ilkka Virta wrote:

Now, perhaps that could use a note explicitly saying this also means
subshells, even though they may
have set -e in effect independently of the main shell.

The part explaining subshells (3.7.3 Command Execution Environment) could
perhaps also use a mention
of that caveat, since it does mention set -e already, though in the context
of command substitution.

So it is clearly not a bug.

The shell -e or bash's errexit option is a problematic tools with hard to understand side-effects.

I can't figure a use-case where a shell would appropriately straight exit without any cleanup or fallback.

This feature deserves a bold disclaimer to think twice before using it rather than explicit error handing.

--
Léa Gris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]