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().

Reply via email to