window下的sqlplus可以通过箭头键,来回看历史命令,用起来非常的方便。

但是在linux里就没有这么方面了,错了一个命令,我们必须重新敲一次,辛苦了手指头叻。

看到一个文章,很方便的一招,给我们带来方便。

通过rlwrap包实现linux里的sqlplus历史命令的功能

可以下载rlwrap包从inthirties里。
可以到安装光盘里找到这个包,也可以下载
http://utopia.knoware.nl/~hlub/uck/rlwrap/

下载
rlwrap-0.30.tar.gz
readline-6.1.tar.gz
到本地

然后解压
由于rlwrap依赖readline包,我们先安装readline包
#tar zxvf Term-ReadLine-Gnu-1.19.tar.gz && cd Term-ReadLine-Gnu-1.19

# perl Makefile.PL

#make && make install
安装以后,我们可以安装rlwrap叻

#gunzip rlwrap-0.30.tar.gz
#tar -xf rlwrap-0.30.tar
#cd rlwrap-0.30
#./configure
#make install
现在rlwrap就已经安装到我们的linux里。

加入要重启生效,不过我们也可以执行ldconfig即时生效

现在我们在试试lrwrap sqlplus命令,是不是很爽呀。

不过每次在前面要多输入lrwrap,确实有些不习惯了,都习惯直接sqlplus,以后要是加上lrwrap也太不习惯了。

解决方法用alias命令就可以叻
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"

可以在启动文件里加入一上两句,就尅直接的sqlplus,

赶快试试吧,是不是感觉自己的手指头轻松多了呀。

 

rlwrap语法及使用

Usage: rlwrap [options] command ...

Options:
  -a[password:]              --always-readline[=password:]
  -A                         --ansi-colour-aware
  -b  <chars>                --break-chars=<chars>
  -c                         --complete-filenames
  -C  <name|N>               --command-name=<name|N>
  -D  <0|1|2>                --history-no-dupes=<0|1|2>
  -f  <completion list>      --file=<completion list>
  -g  <regexp>               --forget-matching=<regexp>
  -h                         --help
  -H  <file>                 --history-filename=<file>
  -i                         --case-insensitive
  -I                         --pass-sigint-as-sigterm
  -l  <file>                 --logfile=<file>
  -n                         --no-warnings
  -N                         --no-children
  -o                         --one-shot
  -O  <regexp>               --only-cook=<regexp>
  -p[colour]                 --prompt-colour[=colour]
  -P  <input>                --pre-given=<input>
  -q  <chars>                --quote-characters=<chars>
  -m[newline substitute]     --multi-line[=newline substitute]
  -r                         --remember
  -R                         --renice
  -v                         --version
  -s  <N>                    --histsize=<N> (negative: readonly)
  -S  <prompt>               --substitute-prompt=<prompt>
  -t  <name>                 --set-term-name=<name>
  -w  <N>                    --wait-before-prompt=<N> (msec, <0  : patient mode)
  -z  <filter command>       --filter=<filter command>

bug reports, suggestions, updates:
http://utopia.knoware.nl/~hlub/uck/rlwrap/

 转自:http://blog.csdn.net/you_tube/article/details/5665848