rlwrap终极解决方案
作者:nero 日期:2009-08-28
当在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能。相反的,在Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句。
但是rlwrap可以实现,于是乎去下载了最新版的rlwrap-0.30.tar.gz,按照网上的步骤,结果编译出错,就是不行啊,在ITPUB,和CU论坛发帖问,也是无人解决~自己也琢磨了半天就是无解,于是准备换个思路用旧版本试试看,一试居然成功了,顶不住啊,感觉是柳暗花明又一村啊~
安装步骤如下:
1.下载rlwrap-0.24,见附件,^_^
点击下载此文件
~
[root@nero /]# cd rlwrap-0.24
[root@nero rlwrap-0.24]# ls
aclocal.m4 ChangeLog configure.ac INSTALL README tools
AUTHORS completions COPYING Makefile.am src
bash30-005.patch config.h.in distribution Makefile.in test
BUGS configure doc NEWS TODO
2.进行配置
[root@nero rlwrap-0.24]# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... (cached) yes
ENABLE ENZ <>
ENABLE ENZ <>
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for perl... /usr/bin/perl
checking for strip... strip
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking for sys/wait.h... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking whether term.h exists and compiles... yes
checking whether your getopt() correctly understands double colons in option string... yes
checking for an ANSI C-conforming const... yes
checking for pid_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether gcc needs -traditional... no
checking return type of signal handlers... void
checking for getopt_long... yes
checking for select... yes
checking for snprintf... yes
checking for strlcpy... no
checking for strlcat... no
checking for strnlen... yes
checking for getopt_long... (cached) yes
checking for setsid... yes
checking for isastream... yes
checking for mkstemp... yes
checking for system... yes
checking for openpty... no
checking for _getpty... no
checking for grantpt... yes
checking for unlockpt... yes
checking for getpt... yes
checking for pty/tty type... GLIBC
configure: checking for pty ranges...
checking for tgetent... no
checking for tgetent in -lcurses... yes
checking for readline in -lreadline... yes
checking whether your readline knows about rl_set_screen_size... yes
Will rlwrap find command's working directory under /proc/<commands pid>/cwd? let's see...
checking for /proc/9130/cwd/configure.ac... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating doc/rlwrap.man
config.status: creating distribution/rlwrap.spec
config.status: creating config.h
config.status: executing depfiles commands
Now do:
make (or gmake) to build rlwrap
make check for instructions how to test it
make install to install it
3.编译
[root@nero rlwrap-0.24]# make
make all-recursive
make[1]: Entering directory `/rlwrap-0.24'
Making all in doc
make[2]: Entering directory `/rlwrap-0.24/doc'
sed -e 's#@DATADIR@#/usr/local/share#' rlwrap.man > rlwrap.1
make[2]: Leaving directory `/rlwrap-0.24/doc'
Making all in src
make[2]: Entering directory `/rlwrap-0.24/src'
source='main.c' object='main.o' libtool=no \
depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'main.c' || echo './'`main.c
source='signals.c' object='signals.o' libtool=no \
depfile='.deps/signals.Po' tmpdepfile='.deps/signals.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'signals.c' || echo './'`signals.c
source='utils.c' object='utils.o' libtool=no \
depfile='.deps/utils.Po' tmpdepfile='.deps/utils.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'utils.c' || echo './'`utils.c
source='readline.c' object='readline.o' libtool=no \
depfile='.deps/readline.Po' tmpdepfile='.deps/readline.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'readline.c' || echo './'`readline.c
source='pty.c' object='pty.o' libtool=no \
depfile='.deps/pty.Po' tmpdepfile='.deps/pty.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'pty.c' || echo './'`pty.c
source='completion.c' object='completion.o' libtool=no \
depfile='.deps/completion.Po' tmpdepfile='.deps/completion.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'completion.c' || echo './'`completion.c
source='term.c' object='term.o' libtool=no \
depfile='.deps/term.Po' tmpdepfile='.deps/term.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'term.c' || echo './'`term.c
source='ptytty.c' object='ptytty.o' libtool=no \
depfile='.deps/ptytty.Po' tmpdepfile='.deps/ptytty.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'ptytty.c' || echo './'`ptytty.c
gcc -DDATADIR=\"/usr/local/share\" -g -O2 -o rlwrap main.o signals.o utils.o readline.o pty.o completion.o term.o ptytty.o -lreadline -lcurses
make[2]: Leaving directory `/rlwrap-0.24/src'
make[2]: Entering directory `/rlwrap-0.24'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/rlwrap-0.24'
make[1]: Leaving directory `/rlwrap-0.24'
4.安装
[root@nero rlwrap-0.24]# make install
Making install in doc
make[1]: Entering directory `/rlwrap-0.24/doc'
make[2]: Entering directory `/rlwrap-0.24/doc'
make[2]: Nothing to be done for `install-exec-am'.
/bin/sh ../tools/mkinstalldirs /usr/local/man/man1
mkdir -p -- /usr/local/man/man1
/usr/bin/install -c -m 644 ./rlwrap.1 /usr/local/man/man1/rlwrap.1
make[2]: Leaving directory `/rlwrap-0.24/doc'
make[1]: Leaving directory `/rlwrap-0.24/doc'
Making install in src
make[1]: Entering directory `/rlwrap-0.24/src'
make[2]: Entering directory `/rlwrap-0.24/src'
/bin/sh ../tools/mkinstalldirs /usr/local/bin
/usr/bin/install -c rlwrap /usr/local/bin/rlwrap
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/rlwrap-0.24/src'
make[1]: Leaving directory `/rlwrap-0.24/src'
make[1]: Entering directory `/rlwrap-0.24'
make[2]: Entering directory `/rlwrap-0.24'
make[2]: Nothing to be done for `install-exec-am'.
/bin/sh ./tools/mkinstalldirs /usr/local/share/rlwrap
mkdir -p -- /usr/local/share/rlwrap
/usr/bin/install -c -m 644 completions/ftp /usr/local/share/rlwrap/ftp
/usr/bin/install -c -m 644 completions/testclient /usr/local/share/rlwrap/testclient
make[2]: Leaving directory `/rlwrap-0.24'
make[1]: Leaving directory `/rlwrap-0.24'
5.OK了
[root@nero rlwrap-0.24]# rlwrap
Usage: rlwrap [options] command ...
Options:
-a, --always-readline[=password:]
-b, --break-chars <chars>
-c, --complete-filenames
-C, --command-name <name|N>
-f, --file <file>
-h, --help
-H, --history-filename <file>
-i, --case-insensitive
-l, --logfile <file>
-n, --no-warnings
-m, --multi-line[=newline substitute]
-r, --remember
-v, --version
-s, --histsize <size> (negative: readonly)
bug reports, suggestions, updates:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@nero rlwrap-0.24]# vi /home/oracle/.bash_profile
添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
[root@nero rlwrap-0.24]# su - oracle
'2.70'*orcl-/home/oracle>sqlplus / as sysdba
OK,大功告成,现在就具备了,记忆历史命令行的功能,大功告成了~
但是rlwrap可以实现,于是乎去下载了最新版的rlwrap-0.30.tar.gz,按照网上的步骤,结果编译出错,就是不行啊,在ITPUB,和CU论坛发帖问,也是无人解决~自己也琢磨了半天就是无解,于是准备换个思路用旧版本试试看,一试居然成功了,顶不住啊,感觉是柳暗花明又一村啊~
安装步骤如下:
1.下载rlwrap-0.24,见附件,^_^
点击下载此文件~
[root@nero /]# cd rlwrap-0.24
[root@nero rlwrap-0.24]# ls
aclocal.m4 ChangeLog configure.ac INSTALL README tools
AUTHORS completions COPYING Makefile.am src
bash30-005.patch config.h.in distribution Makefile.in test
BUGS configure doc NEWS TODO
2.进行配置
[root@nero rlwrap-0.24]# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... (cached) yes
ENABLE ENZ <>
ENABLE ENZ <>
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for perl... /usr/bin/perl
checking for strip... strip
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking for sys/wait.h... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking whether term.h exists and compiles... yes
checking whether your getopt() correctly understands double colons in option string... yes
checking for an ANSI C-conforming const... yes
checking for pid_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether gcc needs -traditional... no
checking return type of signal handlers... void
checking for getopt_long... yes
checking for select... yes
checking for snprintf... yes
checking for strlcpy... no
checking for strlcat... no
checking for strnlen... yes
checking for getopt_long... (cached) yes
checking for setsid... yes
checking for isastream... yes
checking for mkstemp... yes
checking for system... yes
checking for openpty... no
checking for _getpty... no
checking for grantpt... yes
checking for unlockpt... yes
checking for getpt... yes
checking for pty/tty type... GLIBC
configure: checking for pty ranges...
checking for tgetent... no
checking for tgetent in -lcurses... yes
checking for readline in -lreadline... yes
checking whether your readline knows about rl_set_screen_size... yes
Will rlwrap find command's working directory under /proc/<commands pid>/cwd? let's see...
checking for /proc/9130/cwd/configure.ac... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating doc/rlwrap.man
config.status: creating distribution/rlwrap.spec
config.status: creating config.h
config.status: executing depfiles commands
Now do:
make (or gmake) to build rlwrap
make check for instructions how to test it
make install to install it
3.编译
[root@nero rlwrap-0.24]# make
make all-recursive
make[1]: Entering directory `/rlwrap-0.24'
Making all in doc
make[2]: Entering directory `/rlwrap-0.24/doc'
sed -e 's#@DATADIR@#/usr/local/share#' rlwrap.man > rlwrap.1
make[2]: Leaving directory `/rlwrap-0.24/doc'
Making all in src
make[2]: Entering directory `/rlwrap-0.24/src'
source='main.c' object='main.o' libtool=no \
depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'main.c' || echo './'`main.c
source='signals.c' object='signals.o' libtool=no \
depfile='.deps/signals.Po' tmpdepfile='.deps/signals.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'signals.c' || echo './'`signals.c
source='utils.c' object='utils.o' libtool=no \
depfile='.deps/utils.Po' tmpdepfile='.deps/utils.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'utils.c' || echo './'`utils.c
source='readline.c' object='readline.o' libtool=no \
depfile='.deps/readline.Po' tmpdepfile='.deps/readline.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'readline.c' || echo './'`readline.c
source='pty.c' object='pty.o' libtool=no \
depfile='.deps/pty.Po' tmpdepfile='.deps/pty.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'pty.c' || echo './'`pty.c
source='completion.c' object='completion.o' libtool=no \
depfile='.deps/completion.Po' tmpdepfile='.deps/completion.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'completion.c' || echo './'`completion.c
source='term.c' object='term.o' libtool=no \
depfile='.deps/term.Po' tmpdepfile='.deps/term.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'term.c' || echo './'`term.c
source='ptytty.c' object='ptytty.o' libtool=no \
depfile='.deps/ptytty.Po' tmpdepfile='.deps/ptytty.TPo' \
depmode=gcc3 /bin/sh ../tools/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -c `test -f 'ptytty.c' || echo './'`ptytty.c
gcc -DDATADIR=\"/usr/local/share\" -g -O2 -o rlwrap main.o signals.o utils.o readline.o pty.o completion.o term.o ptytty.o -lreadline -lcurses
make[2]: Leaving directory `/rlwrap-0.24/src'
make[2]: Entering directory `/rlwrap-0.24'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/rlwrap-0.24'
make[1]: Leaving directory `/rlwrap-0.24'
4.安装
[root@nero rlwrap-0.24]# make install
Making install in doc
make[1]: Entering directory `/rlwrap-0.24/doc'
make[2]: Entering directory `/rlwrap-0.24/doc'
make[2]: Nothing to be done for `install-exec-am'.
/bin/sh ../tools/mkinstalldirs /usr/local/man/man1
mkdir -p -- /usr/local/man/man1
/usr/bin/install -c -m 644 ./rlwrap.1 /usr/local/man/man1/rlwrap.1
make[2]: Leaving directory `/rlwrap-0.24/doc'
make[1]: Leaving directory `/rlwrap-0.24/doc'
Making install in src
make[1]: Entering directory `/rlwrap-0.24/src'
make[2]: Entering directory `/rlwrap-0.24/src'
/bin/sh ../tools/mkinstalldirs /usr/local/bin
/usr/bin/install -c rlwrap /usr/local/bin/rlwrap
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/rlwrap-0.24/src'
make[1]: Leaving directory `/rlwrap-0.24/src'
make[1]: Entering directory `/rlwrap-0.24'
make[2]: Entering directory `/rlwrap-0.24'
make[2]: Nothing to be done for `install-exec-am'.
/bin/sh ./tools/mkinstalldirs /usr/local/share/rlwrap
mkdir -p -- /usr/local/share/rlwrap
/usr/bin/install -c -m 644 completions/ftp /usr/local/share/rlwrap/ftp
/usr/bin/install -c -m 644 completions/testclient /usr/local/share/rlwrap/testclient
make[2]: Leaving directory `/rlwrap-0.24'
make[1]: Leaving directory `/rlwrap-0.24'
5.OK了
[root@nero rlwrap-0.24]# rlwrap
Usage: rlwrap [options] command ...
Options:
-a, --always-readline[=password:]
-b, --break-chars <chars>
-c, --complete-filenames
-C, --command-name <name|N>
-f, --file <file>
-h, --help
-H, --history-filename <file>
-i, --case-insensitive
-l, --logfile <file>
-n, --no-warnings
-m, --multi-line[=newline substitute]
-r, --remember
-v, --version
-s, --histsize <size> (negative: readonly)
bug reports, suggestions, updates:
http://utopia.knoware.nl/~hlub/uck/rlwrap/
[root@nero rlwrap-0.24]# vi /home/oracle/.bash_profile
添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
[root@nero rlwrap-0.24]# su - oracle
'2.70'*orcl-/home/oracle>sqlplus / as sysdba
OK,大功告成,现在就具备了,记忆历史命令行的功能,大功告成了~
评论: 0 | 引用: 0 | 查看次数: 251
发表评论
上一篇
下一篇


文章来自:
Tags: 





