4 ms·
It's true that modern shells like "bash" are receiving a stream of bytes in what is called the "raw" mode of the tty subsystem. For programs that don't switch
by jclulow 10y ago
It's true that modern shells like "bash" are receiving a stream of bytes in what is called the "raw" mode of the tty subsystem. For programs that don't switch to raw mode, though, the tty is generally in the "cooked" mode that has existed for most of the life of UNIX and similar platforms.
In cooked mode, the kernel is interpreting your input and provides basic line editing facilities -- only once you "commit" a line, generally by pressing something like carriage return or enter, does the kernel make the entire line available on the tty file descriptor.
That's why the author mentions "cat" as a way to witness the kernel's line editing behaviour: it generally leaves the terminal in "cooked" mode.