> 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
That is weird and confusing. Is there somewhere a list of thing to "fix" if one day some people would like to break retrocompat and make a shell as good as bash (and some other well known) but cleaned from such historical queerness ? -------- Message initial -------- **De**: Martin D Kealey <[[email protected]](mailto:martin%20d%20kealey%20%[email protected]%3e)> **À**: Duncan Roe <[[email protected]](mailto:duncan%20roe%20%[email protected]%3e)>, [[email protected]](mailto:[email protected]), Jean-Jacques Brucker <[[email protected]](mailto:jean-jacques%20brucker%20%[email protected]%3e)> **Objet**: Re: why "shopt -p" sometime return non-zero ? **Date**: 25/09/2025 03:41:48 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]](mailto:[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
signature.asc
Description: This is a digitally signed message part
