Linux 下 SQLPLUS 中 退格 方向键问题

一.退格键的问题

如果退格键不能用,可以使用stty命令来解决。该命令可以改变并打印终端行设置。

以前整理的Blog:

stty命令

http://blog.csdn.net/xujinyang/article/details/6884165

看这个命令的帮助:

[oracle@singledb ~]$stty --help

Usage: stty [-F DEVICE] [--file=DEVICE] [SETTING]...

or:stty [-F DEVICE] [--file=DEVICE] [-a|--all]

or:stty [-F DEVICE] [--file=DEVICE] [-g|--save]

Print or change terminal characteristics.

-a, --allprint all current settings in human-readable form

-g, --saveprint all current settings in a stty-readable form

-F, --file=DEVICEopen and use the specified DEVICE instead of stdin

--helpdisplay this help and exit

--versionoutput version information and exit

Optional - before SETTING indicates negation.An * marks non-POSIX

settings.The underlying system defines which settings are available.

Special characters:

* dsusp CHARCHAR will send a terminal stop signal once input flushed

eof CHARCHAR will send an end of file (terminate the input)

eol CHARCHAR will end the line

* eol2 CHARalternate CHAR for ending the line

erase CHARCHAR will erase the last character typed

intr CHARCHAR will send an interrupt signal

kill CHARCHAR will erase the current line

* lnext CHARCHAR will enter the next character quoted

quit CHARCHAR will send a quit signal

* rprnt CHARCHAR will redraw the current line

start CHARCHAR will restart the output after stopping it

stop CHARCHAR will stop the output

susp CHARCHAR will send a terminal stop signal

* swtch CHARCHAR will switch to a different shell layer

* werase CHARCHAR will erase the last word typed

....

Handle the tty line connected to standard input.Without arguments,prints baud rate, line discipline, and deviations from stty sane.In settings, CHAR is taken literally, or coded as in ^c, 0x37, 0177 or 127; special values ^- or undef used to disable special characters.

Report bugs to <bug-coreutils@gnu.org>.

[oracle@singledb ~]$

与退格键相关的设置是erase,它表示删除最后一个字符。

$stty erase ^H

说明:按下退格键会显示成^H

如果在当前窗口执行的话,只对当前的窗口有效,下次登陆的时候还需要重新设置,可以把这个命令写入shell的配置文件,如~/.bashrc中,这样每次都能生效了。

二.方向键的问题

WIN下使用方向键是没有问题的,但是在Linux下,方向键是使用不了了。可以安装一下rlwrap工具。

rlwrap本身是个遵循GPL标准的Shell脚本,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能。

可以在http://rpm.pbone.net/上搜到这个工具的RPM包。

http://rpm.pbone.net/index.php3/stat/4/idpl/14484200/dir/redhat_el_5/com/rlwrap-0.3

7-1.el5.i386.rpm.html

[root@singledb mnt]# rpm -ivh rlwrap-0.37-1.el5.i386.rpm

warning: rlwrap-0.37-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6

Preparing...########################################### [100%]

1:rlwrap########################################### [100%]

[oracle@singledb ~]$ rlwrap sqlplus / as sysdba;

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 3 15:13:13 2012

Copyright (c) 1982, 2005, Oracle.All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select * from v$version;

BANNER

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

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE10.2.0.1.0Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

SQL> select * from v$version;

现在就可以上下翻动了。但是这样没事都需要加上rlwrap也是很麻烦的,可以对rlwrap做一个别名,放到shell的配置文件里,在~/.bashrc文件里添加如下内容:

alias sqlplus='rlwrap sqlplus'

[oracle@singledb ~]$ cat ~/.bashrc

# .bashrc

# Source global definitions

if [ -f /etc/bashrc ]; then

. /etc/bashrc

fi

# User specific aliases and functions

alias sqlplus='rlwrap sqlplus'

[oracle@singledb ~]$

[oracle@singledb ~]$ source ~/.bashrc--让参数生效

[oracle@singledb ~]$sqlplus / as sysdba;--然后就可以正常使用sqlplus了

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 3 15:18:07 2012

Copyright (c) 1982, 2005, Oracle.All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select * from v$version;

BANNER

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

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE10.2.0.1.0Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

SQL>

其他一些组合键:

Ctrl+A:ahead,到行的顶端,相当于Home

Ctrl+E:end,到行的末端,相当于end

Ctrl+B:behind,后退一个字符,相当于left

Ctrl+F:forward,前进一个子放入,相当于right

Ctrl+P:prev.,上一行历史记录,相当于up

Ctrl+N:next.,下一行历史记录,相当于down

Ctrl+U:undo,回复操作,这行就被清空掉了

Ctrl+W:剪切

Ctrl+Y:粘贴

Ctrl+L:cLear,清屏

整理自网络

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值