[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use of set -e inside parenthesis and conditionnal second command
From: |
Rusty Bird |
Subject: |
Re: use of set -e inside parenthesis and conditionnal second command |
Date: |
Tue, 17 Nov 2020 16:06:00 +0000 |
Greg Wooledge:
> The behavior of set -e is extremely surprising, and people should
> stop expecting it to make intuitive sense. The best way to avoid being
> surprised by it is to stop using it altogether.
Has it ever been considered to add something like 'shopt -s
composable_compound'? Roughly meaning "execution and exit status of a
compound command are not changed by surrounding context (in the sense
of logical operators, or being the condition of an if statement etc.)"
That, together with 'set -e -o pipefail; shopt -s inherit_errexit'
seems like it would go a long way towards easier error handling.
Rusty
signature.asc
Description: PGP signature