rlwrap的使用

转至:http://blog.itpub.net/429786/viewspace-776177/

在LINUX下使用ORACLE一些命令时(如sqlplus,rman等),经常需要调用上次或之前运行过的命令或者输入错误时使用回退键删除,而rlwrap就提供了这一功能。
可从以下地址获取rlwrap:
http://utopia.knoware.nl/~hlub/rlwrap/ 下载rlwrap-0.37.tar.gz
或者从以下地址获取对应版本的安装包:

http://rpm.pbone.net/index.php3/stat/4/idpl/15288816/dir/redhat_el_6/com/rlwrap-0.37-1.el6.x86_64.rpm.html

http://rpm.pbone.net/index.php3/stat/4/idpl/15276193/dir/redhat_el_5/com/rlwrap-0.37-1.el5.x86_64.rpm.html

安装

#tar zxvf rlwrap-0.37.tar.gz
#cd rlwrap-0.37
# ./configure && make && make install

或者

#rpm -ivh rlwrap-0.37-1.el6.x86_64.rpm

检查是否安装成功

[root@dg ~]# rlwrap
Usage: rlwrap [options] command ...

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

bug reports, suggestions, updates:

http://utopia.knoware.nl/~hlub/uck/rlwrap/


使用
--直接在命令前加上rlwrap

[oracle@dg ~]$ rlwrap sqlplus / as sysdba

或者配置环境变量,在末尾添加以下行

[oracle@dg ~]$ vi .bash_profile
stty erase ^h
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'

--使环境变量立即生效

[oracle@dg ~]$ source  .bash_profile
原文地址:https://www.cnblogs.com/my-first-blog-lgz/p/13870635.html