C Shell (csh) Backspace key cancels the command not erasing the command

2.8k views Asked by At

In my HP-UX (B.11.23 U ia64) box, Csh is running as login shell.

what /usr/bin/csh

sh.lex.c $Date: 2005/02/28 10:00:30 $Revision: r11.23/2 PATCH_11.23 (PHCO_32667) $Revision: @(#) csh R11.23_BL2005_0301_1 PATCH_11.23 PHCO_32667

But when I type any command in the prompt and press Backspace key then the typed command gets cancelled and the cursor goes to the next line without executing the command. The erasing of the command is not happening. I have tried setting:

stty erase <backspace>

stty erase ^H

but did not work.

I would like to know how to make the Backspace key work as normal, that is, it has to erase the typed characters

stty -a

*speed 38400 baud; line = 0;
rows = 24; columns = 80
min = 1; time = 1;
intr = DEL; quit = ^\; erase = DEL; kill = @
eof = ^D; eol = ^@; eol2 <undef>; swtch <undef>
stop = ^S; start = ^Q; susp <undef>; dsusp <undef>
werase <undef>; lnext <undef>
-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crts
-ignbrk brkint -ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
ixon ixany -ixoff -imaxbel -rtsxoff -ctsxon -ienqak
isig icanon -iexten -xcase echo -echoe echok -echonl -noflsh
-echoctl -echoprt -echoke -flusho -pendin
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop tab3*
2

There are 2 answers

1
jlliagre On

This is usually fixed with typing:

stty erase Control + VBackspace

To get the current settings, run:

stty -a  

Edit:

The issue is DEL is set to both the erase and interrupt characters, fix the latter with:

stty intr Control + C

Alternatively:

stty intr `printf "\03"`
0
Thomas Dickey On

Probably your terminal is sending some other character than ^H (control+H), for example DEL (commonly echoed as ^?). You might see that character in the output of stty -a.