Re: :? within a function
Chet Ramey <[email protected]> Mon, 18 May 2026 15:49:40 -0400
| Newsgroups | gmane.comp.shells.bash.bugs,gmane.comp.shells.bash.help |
|---|---|
| Organization | ITS, Case Western Reserve University |
| Message-ID | <[email protected]> |
On 5/18/26 5:02 AM, Robert Elz wrote: > | An interactive shell does not exit, but does not execute the > | command associated with the expansion and any containing function > | calls exit with a nonzero status. > > That's too specific, the general rule for when a non-interactive shell > would exit because of some condition or other, is that interactive shells > instead abandon all they are doing, whatever it is, and return immediately > to the highest level command prompt (issue PS1 and wait for a new command > with $? set to indicate failure). > > I have no reason to believe bash differs from all other shells in this regard, The behavior is more varied than you think. Bash, yash, and mksh do it one way, ksh93 and the ash-based shells (dash, netbsd sh, etc.) do it the other. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
(application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE----- wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCagttVQUDAAAAAAAKCRC7WGnwZOp0qyiZ AJ4nCkOQdLpOfZAUeAMPXvaDeN/Q3QCdHo2oA6ZwTcrxJjwfAQ06yDs85RE= =5fec -----END PGP SIGNATURE-----