MUCH TO DO ABOUT ERASING by Gary T. Leavens Department of Computer Science, Iowa State University File $Date: 1997/08/20 18:44:37 $ If you are having erasing characters in an interpreter, it's probably because you don't have the Unix "erase character" set up the way you think you do. This may be confusing, because some programs, such as the Unix shell, are set up to work with several erase characters, and so the problem may appear to be caused by the interpreter. Also keyboards for different computers sometimes swap the delete and backspace characters, which are the most common erase characters. In addition, the X window system also translates some character sequences for you, and so the problems may only show up when you connect via telnet. But if you are using a terminal program to connect (such as hyperterminal), that program can also translate backspaces into delete. Despite this, your Unix erase character setting affects *all* input to Unix, including the interpreters! Another source of confusion is that, on the Com S department HP-UX machines, by default (unless you changed your .login files) the erase character is the backspace key, while on Iowa State's project Vincent, the default is the delete key. You can find out what Unix has as your erase character by looking at the output of the "stty" command. Type at the shell prompt: stty If it says "...; erase = ^H; ...", (on the 2nd line) then you are set up to use the backspace key to erase mistakes on input. If it says "...; erase = DEL; ...", then you are set up to use the delete key, probably because you changed it yourself sometime in the past. Here's what to do about it. First look at the key you are hitting to erase characters. It should be labelled as backspace or delete. If you want to use backspace to erase characters. (a) if you have delete as your Unix erase character (see above), then put the line stty erase '^H' at the end of your .login file. Log out, then log back in. (b) if you have backspace as your Unix erase character, see if some program is translating the backspace into delete before it gets to Unix. Check your terminal connection program or xmodmap. (c) If you're an emacs user, you may want to tell emacs to treat ^H the same as delete, see the course file ``sample-.emacs'' for how to do that. If you want to use delete to erase characters. (a) if you have backspace as your Unix erase character (see above), then put the line stty erase '^?' at the end of your .login file. Log out, then log back in. (b) if you have delete as your Unix erase character, see if some program is translating the delete into backspace before it gets to Unix. Check your terminal connection program or xmodmap.