Groups | Search | Server Info | Login | Register
Groups > muc.lists.netbsd.tech.userlevel > #11710
| From | Crystal Kolipe <kolipe.c@exoticsilicon.com> |
|---|---|
| Newsgroups | muc.lists.netbsd.tech.userlevel |
| Subject | Re: set -e again |
| Date | 2026-01-14 13:46 +0000 |
| Organization | Newsgate at muc.de e.V. |
| Message-ID | <aWeeKG8ziRu40n77@exoticsilicon.com> (permalink) |
| References | <> <202601141241.HAA04556@Stone.Rodents-Montreal.ORG> |
On Wed, Jan 14, 2026 at 07:41:41AM -0500, Mouse wrote:
> >> [...set -e vs shell functions...]
>
> > Does this achieve what you want?
>
> > #!/bin/sh
> > set -e
> > f() {
> > echo foo
> > false
> > echo bar
> > }
> > f
> > [ $? ] || echo baz
> > echo buzz
>
> I'm not the original poster, but it does not achieve what I would
> expect, which is
>
> foo
> baz
> buzz
>
> That is, I would expect/want -e to cause the function to return showing
> failure. Instead, it either does nothing or takes down the whole
> shell.
Ah, OK, the way I understood the OP was that 'false' taking down the whole
script was the desired/expected behaviour, but that that was not happening in
the second example with the conditional testing the exit staus of f().
--
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 | Next in thread | Find similar
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