Date:        Fri, 25 Sep 2026 12:19:53 -0400
    From:        Chet Ramey <[email protected]>
    Message-ID:  <[email protected]>

  | Not quite. It suppresses the immediate exit in a non-interactive shell.

Yes, that's what I was intending to say!

  | Interactive shells don't exit if `exec' fails.

Yes, I knew that, I just don't always type what I am thinking!

  | Some other internal mechanism, yes.

It had to be .. though I'm not sure I follow what you said in your reply
to the OP..  execfail does avoid exit in *non*-interactive shells, but
causes a 127 exit status (for the example case anyway, I guess it might
be 126 in some other cases).   errexit (-e) causes the shell to exit if
a non-zero exit status happens (in simple commands anyway).   Except when
it is being ignored by one of the things that makes that happen.   How
turning on execfail can cause errexit to make the shell exit, when nothing
else does when errexit is being ignored seems odd to me, the two things
should not really be related (directly) in any way at all - errexit doesn't
(or shouldn't) care why the non-zero exit status happened, just that it is
not currently being ignored.   And execfail shouldn't care whether or not
errexit is set, it should just skip the exit that normally happens, and
return its status code to whatever is to come next.

  | It's actually an easy change.

OK, but so is avoiding using -e and all the problems and weirdness that
comes with it.

kre


Reply via email to