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 chet@case.edu http://tiswww.cwru.edu/~chet/