linux 终端backspace不能删除字符
时间:2023-03-28 05:30:16 点击:410

在linux/unix平台的经常使用scanf从键盘获取字符,输出字符后按Backspace键删除时,会出现^H,这对习惯了按Backspace键删除的用户来说,感觉非常别扭,虽然可以通过Ctrl+Backspace组合键实现删除功能可通过stty命令修改终端配置来实现Backspace删除功能。如下:

QUOTE:

[oracle@RHEL5 ~]$ id

uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(asadmin)

[oracle@RHEL5 ~]$ stty erase ^h

若要恢复Ctrl+Backspace组合键删除功能,可执行以下命令:

QUOTE:

[oracle@RHEL5 ~]$ id

uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(asadmin) [oracle@RHEL5 ~]$ stty erase ^?

同时可通过stty -a查看所有的终端设置:

QUOTE:

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

最新游戏更多

最新软件更多

  • 玩家推荐
  • 游戏攻略

金钼软件下载站 Copyright(C) 2008- 601958.cn All Rights Reserved!

闽ICP备2023004188号| 免责声明