On Wed, Sep 24, 2025 at 22:55+1000, Jean-Jacques Brucker wrote: > So "... || true" is here required when "set -e".
On Thu, 25 Sept 2025 at 09:03+1000, Duncan Roe via Bug reports for the GNU Bourne Again SHell <[email protected]> wrote: > `||:` also works - I use it sometimes in SBo scripts (all their templates > have > `set -e`). > Or a leading ‘!’, like: ! saved_shopts=$( shopt -p ) Aside from a stylistic preference for a suffix rather than prefix, I wonder why this isn't more commonly suggested? -Martin PS: a prefix ‘!’ does *not* cause errexit to be triggered when the command has a zero exit status, and it's been that way for a long time: $ set -e ; ! true ; ! false ; type ! ; echo $BASH_VERSION ; false ; echo Still here ! is a shell keyword 2.01.0(1)-release
