本文谢绝转载原文来自http://990487026.blog.51cto.com



rlwrap官网:

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


 

wKioL1fGkiTC9ymmAAClyF2GjdY178.png



开始干活吧!



系统属性:

CentOS 6.8_X64,基于桌面,附加开发工具包安装.



下载源码,编译,安装:

[oracle@oracle11 ~]$ mkdir /tmp/mytest
[oracle@oracle11 ~]$ cd /tmp/mytest
[oracle@oracle11 mytest]$ wget http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.42.tar.gz
[oracle@oracle11 mytest]$ echo $?
0
[oracle@oracle11 mytest]$ tar xf rlwrap-0.42.tar.gz 
[oracle@oracle11 mytest]$ cd rlwrap-0.42
[oracle@oracle11 rlwrap-0.42]$ ./configure 
You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build
this program!
[oracle@oracle11 rlwrap-0.42]$ echo $?
1
提示我缺readline library,切换到root下
[root@oracle11 ~]# yum install -y readline-devel
[oracle@oracle11 rlwrap-0.42]$ ./configure 
[oracle@oracle11 rlwrap-0.42]$ echo $?
0
编译环境检查通过!


那么久开始编译吧:
[oracle@oracle11 rlwrap-0.42]$ make
[oracle@oracle11 rlwrap-0.42]$ echo $?
0

root权限来安装
[root@oracle11 ~]# cd /tmp/mytest/rlwrap-0.42
[root@oracle11 rlwrap-0.42]# make install 
[root@oracle11 rlwrap-0.42]# echo $?
0



测试:

[root@oracle11 rlwrap-0.42]# rlwrap 
Usage: rlwrap [options] command ...

Options:
  -a[password prompt]        --always-readline[=password prompt]
  -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>
  -e  <char|''>              --extra-char-after-completion=<char|''>
  -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>
  -m[newline substitute]     --multi-line[=newline substitute]
  -M  <.ext>                 --multi-line-ext=<.ext>
  -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>
  -r                         --remember
  -R                         --renice
  -s  <N>                    --histsize=<N> (negative: readonly)
  -S  <prompt>               --substitute-prompt=<prompt>
  -t  <name>                 --set-term-name=<name>
  -U                         --mirror-arguments
  -v                         --version
  -w  <N>                    --wait-before-prompt=<N> (msec, <0  : patient mode)
  -W                         --polling
  -z  <filter command>       --filter=<filter command> (-z listing lists installed filters)

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



设置别名:

[oracle@oracle11 rlwrap-0.42]$ echo "alias sqlplus='rlwrap sqlplus'" >> /home/oracle/.bashrc
[oracle@oracle11 rlwrap-0.42]$ cd
[oracle@oracle11 ~]$ source .bashrc



安装方式2, 

chunli@CentOS/tmp $ git clone https://github.com/hanslub42/rlwrap
chunli@CentOS/tmp$ cd rlwrap/
chunli@CentOS/tmp/rlwrap$ autoreconf --install
chunli@CentOS/tmp/rlwrap$ sudo yum install -y readline-devel
chunli@CentOS/tmp/rlwrap$ ./configure && make
chunli@CentOS/tmp/rlwrap$ sudo make install 
chunli@CentOS/tmp/rlwrap$ rlwrap --version
rlwrap 0.43
chunli@CentOS/tmp/rlwrap$ echo "alias sqlplus='rlwrap sqlplus'" >> ~/.bashrc
chunli@CentOS/tmp/rlwrap$ . ~/.bashrc





测试我的上下左右键:

[oracle@oracle11 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 31 16:08:43 2016

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> 

SQL> conn as sysdba


上下左右键回来了


wKioL1fGkxOxOKBFAABhhlU2P_w505.png