unix/TypingEOFEffects written at 01:10:49; Add Comment
What typing ^D really does on Unix
Everyone knows what ^D does on Unix; it generates an end of file,
But this is just the usual effects of typing ^D; it is not what it actually does. What ^D actually does is simple but subtle:
Normally doing a
Typing ^D causes the tty driver to stop waiting for a newline and
immediately return from the
(Other programs will immediately process the partial line with no
Once you've typed ^D on a partial line, that portion of the line is immutable because it's already been given to the program. Most Unixes won't let you backspace over such partial lines; effectively they become output, not input.
(Note that modern shells are not good examples of this, because they don't do line-buffered input; to support command line editing, they switch terminal input into an uninterpreted mode. So they get the raw ^D and can do whatever they want with it, and they can let you edit as much of the pending line as they want.)
* * *
Atom feeds are available; see the bottom of most pages.