Chinaunix首页 | 论坛 | 博客
  • 博客访问: 260642
  • 博文数量: 30
  • 博客积分: 1905
  • 博客等级: 上尉
  • 技术积分: 466
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-30 13:48
文章分类

全部博文(30)

文章存档

2012年(1)

2011年(10)

2010年(18)

2008年(1)

我的朋友

分类: LINUX

2010-07-13 13:53:36

在linux/unix平台上的sqlplus中,如果输错了字符,要想删除,习惯性的按下backspace键后,发现非但没有删除想要删掉的字符,还多出了两个字符^H。当然,我们可以同时按下ctrl+backspace键来删除,但对于习惯了用backspace来删除的用户,这样很不爽。这可以通过修改tty终端的设置来实现backspace删除功能。通过使用stty命令,就可以查看或者修改终端的按键设置。

例如,设置backspace为删除键:

[oracle10g@linux]$ stty erase ^h

如果要改回使用ctrl+backspace为删除键

[oracle10g@linux]$ stty erase ^?
 
[转载注]在设置backspace时,最好先在shell提示符下按一下backspace键试一下,如果显示^h就设置成stty erase ^h, 如果^?就用stty erease ^?

如果需要重启后自动设置终端,可以将上述命令加入到profile中。

可以通过stty -a命令来查看所有的终端设置。下面是在linux下执行的输出:

[oracle10g@linux]$ stty -a
speed 38400 baud; rows 66; columns 132; 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

其中:

  • eof : 输入结束
  • erase : 向后删除字符,
  • intr : 中断当前程序
  • kill : 删除整条命令
  • quit :退出当前程序
  • start : 启动屏幕输出
  • stop :停止屏幕输出;
  • susp : terminal stop当前程序。

-------------------

下面是我的.bashrc下面的相关设置

# Terminal-related commands, tput, tset, stty, etc should not be
# executed by vuelogin or dtlogin. These login environments set $VUE
# and $DT accordingly.
#
if [ ! "$VUE" -a ! "$DT" ]; then
  # Terminal specific commands...
  #tty -s && stty intr ^c susp ^z kill ^X erase ^h quit ^\\ eof ^d
  tty -s && stty intr ^c susp ^z kill ^X erase ^? quit ^\\ eof ^d
fi

 

阅读(721) | 评论(0) | 转发(0) |
0

上一篇:使用screen与用户远程互动

下一篇:du 与df

给主人留下些什么吧!~~