On 1/12/24 1:06 PM, Oğuz wrote:

Why would that be unexpected, since you're explicitly running something
in the calling shell's context, with the expected side effects to that
environment?

I wasn't clear. This doesn't exit the shell

     bash-5.3$ exec foo
     bash: exec: foo: not found
     bash-5.3$

This does:

     bash-5.3$ : ${ exec foo;}
     bash: exec: foo: not found
     $

Why would you expect either to cause an interactive shell to exit?

Oh, I see, an interactive shell. Think of funsubs in an interactive shell
as being temporarily non-interactive, like when the shell executes
./source. If you source a file from an interactive shell, a failed exec
causes the shell to exit.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to