在linux/unix平臺的常用scanf從鍵盤獲取字符,輸出字符後按Backspace鍵刪除時,會出現^H,這對習慣了按Backspace鍵刪除的用戶來講,感受很是彆扭,雖然能夠經過
java
Ctrl+Backspace
組合鍵實現刪除功能
linux
可經過stty命令修改終端配置來實現Backspace刪除功能。以下:oracle
QUOTE: post
[oracle@RHEL5 ~]$ id uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(asadmin) [oracle@RHEL5 ~]$ stty erase ^h
若要恢復Ctrl+Backspace組合鍵刪除功能,可執行如下命令:ui
QUOTE:spa
[oracle@RHEL5 ~]$ id uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(asadmin) [oracle@RHEL5 ~]$ stty erase ^?
同時可經過stty -a查看全部的終端設置:unix
QUOTE:code
oracle||oralinux||/home/oracle||-->>id uid=500(oracle) gid=501(oinstall) groups=500(dba),501(oinstall) oracle||oralinux||/home/oracle||-->>stty -a speed 38400 baud; rows 24; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = ; eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke