Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16363 > unrolled thread

Re: bash errexit shell option does not work in some cases.

Started byRobert Elz <kre@munnari.OZ.AU>
First post2020-06-01 17:28 +0700
Last post2020-06-01 17:28 +0700
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: bash errexit shell option does not work in some cases. Robert Elz <kre@munnari.OZ.AU> - 2020-06-01 17:28 +0700

#16363 — Re: bash errexit shell option does not work in some cases.

FromRobert Elz <kre@munnari.OZ.AU>
Date2020-06-01 17:28 +0700
SubjectRe: bash errexit shell option does not work in some cases.
Message-ID<mailman.1236.1591416798.2541.bug-bash@gnu.org>
    Date:        Sun, 31 May 2020 22:46:48 -0400
    From:        Eli Schwartz <eschwartz@archlinux.org>
    Message-ID:  <5a7df0ba-3ad1-1f35-1107-09fdd5950359@archlinux.org>

While I generally agree with ...

  | Don't use errexit

but not really with:

  | it does not mean what you think it does.

(it does mean what I think it means ...)

in this case:

  | You're merely the latest person to discover that this applies to you:
  | http://mywiki.wooledge.org/BashFAQ/105

doesn't really apply - the cases reported are simply bugs in bash,
a shell implementing -e correctly should exit as it was expected to.

This all results from earlier posix specs where -e and simple commands
were linked - the wording has been improved (still short of perfect)
and simple commands are no longer relevant (other than that exit status
generally originates with the result from a simple command).

I would note that the "echo end..." after the earlier echo that prints
the exit status is poinltless - the echo printing the exit status is all
that is needed, that one exits with status 0, so the following command is
obviously going to run - if the shell were working properly, the first
echo (and anything following) would never be encountered.

All that said, back to the original advice, unless you really know what
you're doing, and really understand the examples in Greg's FAQ page,
then you almost certainly shouldn't be using -e.

kre

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web