On 4/16/19 7:37 PM, Paul Wise wrote: > On Tue, 2019-04-16 at 14:57 -0400, Chet Ramey wrote: > >> Why take so much effort to (imperfectly) figure out and display >> things you already know? > > Correctness. If what the user knows doesn't match what the program > knows then they might think that the program is buggy
OK, let's explore that a little.
1. The user types ^C, and knows he typed it.
2. The shell sets $? to 130 (128+SIGINT) to note that a command was
interrupted during parsing.
3. The user types ^C, and knows he typed it.
4. The shell sets $? to 130 for the same reason.
Compare that to
1. The user types ^C, and knows he typed it.
2. The shell sets $? to 130 (128+SIGINT) to note that a command was
interrupted during parsing.
3. The user types RET, and knows he typed it.
4. The shell doesn't change $?, since no command was executed to change it.
What is the `correctness' rationale to change this? Why should the shell
modify well-understood rules? The user knows what he did, and should know
the consequences of those actions on what the shell exposes externally.
--
``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/
signature.asc
Description: OpenPGP digital signature
