Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > muc.lists.netbsd.tech.userlevel > #11711
| From | Robert Elz <kre@munnari.OZ.AU> |
|---|---|
| Newsgroups | muc.lists.netbsd.tech.userlevel |
| Subject | Re: set -e again |
| Date | 2026-01-14 21:09 +0700 |
| Organization | Newsgate at muc.de e.V. |
| Message-ID | <17878.1768399781@jacaranda.noi.kre.to> (permalink) |
| References | <aWbu963HcQMeCm2M@netbsd.org> |
Date: Wed, 14 Jan 2026 01:18:47 +0000
From: David Holland <dholland-tech@netbsd.org>
Message-ID: <aWbu963HcQMeCm2M@netbsd.org>
| I discovered the following today.
I would have expected you to be aware of all this already.
| This seems wrong - the exit status of the f is guarded, but the false
| is not.
Doesn't matter, it is executing in a place to the left of a || hence
the setting of -e is ignored.
| Is this intended, and is there a way to get the user's intended
| behavior of exit on unchecked failure back?
It is, and no, there isn't. Use of -e in anything other than a list of
simple commands, one after the other, almost always runs into problems.
It was originally intended for (old style) makefile use, not for lazy
script writers.
Simply explicitly test every command's status which matters, explicitly,
and everything will work as you intend. Don't use -e, almost ever.
(And -u isn't a lot better, but at least that one is more predictable).
kre
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Back to muc.lists.netbsd.tech.userlevel | Previous | Next — Previous in thread | Find similar | Unroll thread
set -e again David Holland <dholland-tech@netbsd.org> - 2026-01-14 01:18 +0000
Re: set -e again "Greg A. Woods" <woods@planix.ca> - 2026-01-13 18:14 -0800
Re: set -e again Mouse <mouse@Rodents-Montreal.ORG> - 2026-01-13 21:30 -0500
Re: set -e again Crystal Kolipe <kolipe.c@exoticsilicon.com> - 2026-01-14 10:28 +0000
Re: set -e again Mouse <mouse@Rodents-Montreal.ORG> - 2026-01-14 07:41 -0500
Re: set -e again Crystal Kolipe <kolipe.c@exoticsilicon.com> - 2026-01-14 13:46 +0000
Re: set -e again Robert Elz <kre@munnari.OZ.AU> - 2026-01-14 21:22 +0700
Re: set -e again RVP <rvp@SDF.ORG> - 2026-01-14 13:39 +0000
Re: set -e again Robert Elz <kre@munnari.OZ.AU> - 2026-01-14 21:09 +0700
csiph-web