[One curiosity that some people notice is that on BSD systems, you can't backspace over shell prompts, but on System V, you can go right back to the edge of your screen or window, erasing the prompt. Brandon Allberry explains that here. -TOR ]
You can make the BSD system behave like the System V one with stty old. But I don't think that's what you want....
The System Vmakes no assumptions about the sanity or configuration of the terminal, and therefore doesn't try to get fancy with echoing. It can be annoying at times to see the system acting so stupidly, but it won't suddenly act up on you.
The BSD tty driver makes the assumption that the terminal is behaving sanely,
and that nothing is playing games with escape sequences, etc., so it can get
away with assuming how to stop at the prompt.
To this end, it echoes control
"uparrow format" [like
^A for CTRL-a-JP ]
and assumes you have the stty tabs setting
correct for the terminal (
stty tabs only if the terminal has 8-character
hardware tabs set, otherwise
But it also requires various
other trickery (such as
stty tilde to compensate for old Hazeltine
terminals that use
~ instead of the ASCII ESC character) to stay in
sync with strange terminals.
The BSD method mostly works, but has some drawbacks: for example, on a DEC-compatible terminal I sometimes have toto get the terminal to display ASCII instead of graphics characters. Under System V, this is convenient: it can be done by typing the control character at the shell command line, then backspace, then RETURN to redisplay the prompt as something other than Greek. Under BSD I have to resort to . Also, while BSD will echo "typed" control characters in uparrow format, it won't help you if a backgrounded program splatters control characters at the terminal. (Well, you can , but sometimes you "want" that behavior from some particular backgrounded program: a status message, for example.)
Programs like ksh and tcsh also do "smart" echoing. They have the same problems, plus an additional one: the BSD tty driver can tell when another program scribbles on the terminal while doing a line-buffered read and automatically redisplays the input line after the next keystroke. A user program has no way to find out about such scribbling, however, so you can get into a decidedly non-WYSIWYG situation despite every attempt by the program to make things look right. At least System V is honest in not promising anything.
Such are the problems with non-regulated access by a multi-tasking system to a non-multiplexed device like a terminal, and such are the possible solutions. You choose the one that works best in your particular situation.
- in comp.unix.misc on Usenet, 12 October 1991