1.rlwrap介绍 rlwrap is a 'readline wrapper' that
uses the GNU readline library to allow the editing of keyboard input for any
other command. Input history is remembered across invocations, separately for
each command; history completion and search work as in bash and completion word
lists can be specified on the command line.
rlwrap runs the specified
command, intercepting user input in order to provide readline’s line editing,
persistent history and completion. rlwrap tries to be as transparent as
possible, keeping track of command’s terminal settings, so that it can do the
right thing when command asks for single keypresses or for a
password.
突然,有一天(早晚有一天),您发现Windows上这个功能在Linux上不复存在,心中不免有些惆怅。 这时,您有两种选择, 第一种选择是:慢慢适应Linux下SQL*Plus的操作习惯,以Vi编辑器与edit命令结合编辑最近一条使用的SQL(This
is a good method.); 第二种选择是:寻找第三方的小工具来满足这个从Windows上继承下来的“弊病”,这个小文儿就来介绍这样一个辅助小工具,它的名字叫做rlwrap=“readline
wrapper”。
5.安装rlwrap 1)使用解压目录中的configure文件进行配置 [root@testdb183 rlwrap-0.30]#
./configure checking build system type...
x86_64-unknown-linux-gnu checking host system type...
x86_64-unknown-linux-gnu checking for a BSD-compatible install...
/usr/bin/install -c checking whether build environment is sane...
yes checking for a thread-safe mkdir -p...
/bin/mkdir -p 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 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 ISO C89...
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 grep that handles long lines and
-e... /bin/grep checking for egrep... /bin/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
sched.h usability... yes checking sched.h presence... yes checking
for sched.h... 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
curses.h usability... yes checking curses.h presence... yes checking
for curses.h... yes checking ncurses/term.h usability...
yes checking ncurses/term.h presence...
yes checking for ncurses/term.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 sched_yield... 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 readlink... yes checking
for setenv... yes checking for putenv... yes checking
for openpty in -lutil... yes checking for openpty... yes checking
for getpty... no checking for grantpt... yes checking
for unlockpt... yes checking for getpt... yes checking
for pty/tty type... checking pty.h usability... yes checking
pty.h presence... yes checking for pty.h... yes OPENPTY 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 checking whether your readline knows about
rl_variable_value... yes checking whether your readline knows about
rl_readline_version... yes Will rlwrap find command's working directory
under /proc//cwd? let's see... checking
for /proc/18843/cwd/configure.ac... yes
上面的信息有点复杂了,其实我们很简单,只要在输入sqlplus之前加上rlwrap就可以了。演示如下: ora10g@testdb183 /home/oracle$ rlwrap sqlplus /
as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on
Mon Sep 7 14:23:43 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to: Oracle
Database 10g Enterprise Edition Release
10.2.0.3.0 - 64bit Production With the Partitioning, Oracle Label Security,
OLAP and Data Mining Scoring Engine
options
4,安装readline 1)使用解压目录中的configure文件进行配置 [root@localhost readline-6.2]# ./configure checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu
Beginning configuration for readline-6.2 for i686-pc-linux-gnu
checking whether make sets $(MAKE)... yes 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 ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... 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 minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking whether gcc needs -traditional... no checking for a BSD-compatible install... /usr/bin/install -c checking for ar... ar checking for ranlib... ranlib checking for an ANSI C-conforming const... yes checking for function prototypes... yes checking whether char is unsigned... no checking for working volatile... yes checking return type of signal handlers... void checking for size_t... yes checking for ssize_t... yes checking for ANSI C header files... (cached) yes checking whether stat file-mode macros are broken... no checking for dirent.h that defines DIR... yes checking for library containing opendir... none required checking for fcntl... yes checking for kill... yes checking for lstat... yes checking for memmove... yes checking for putenv... yes checking for select... yes checking for setenv... yes checking for setlocale... yes checking for strcasecmp... yes checking for strpbrk... yes checking for tcgetattr... yes checking for vsnprintf... yes checking for isascii... yes checking for isxdigit... yes checking for getpwent... yes checking for getpwnam... yes checking for getpwuid... yes checking for working strcoll... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking for unistd.h... (cached) yes checking for stdlib.h... (cached) yes checking varargs.h usability... no checking varargs.h presence... no checking for varargs.h... no checking stdarg.h usability... yes checking stdarg.h presence... yes checking for stdarg.h... yes checking for string.h... (cached) yes checking for strings.h... (cached) yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking pwd.h usability... yes checking pwd.h presence... yes checking for pwd.h... yes checking for memory.h... (cached) yes checking termcap.h usability... no checking termcap.h presence... no checking for termcap.h... no checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking termio.h usability... yes checking termio.h presence... yes checking for termio.h... yes checking sys/pte.h usability... no checking sys/pte.h presence... no checking for sys/pte.h... no checking sys/stream.h usability... no checking sys/stream.h presence... no checking for sys/stream.h... no checking sys/select.h usability... yes checking sys/select.h presence... yes checking for sys/select.h... yes checking sys/file.h usability... yes checking sys/file.h presence... yes checking for sys/file.h... yes checking for sys/ptem.h... no checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for type of signal functions... posix checking if signal handlers must be reinstalled when invoked... no checking for presence of POSIX-style. sigsetjmp/siglongjmp... present checking for lstat... yes checking whether or not strcoll and strcmp differ... no checking whether the ctype macros accept non-ascii characters... yes checking whether getpw functions are declared in pwd.h... yes checking whether termios.h defines TIOCGWINSZ... no checking whether sys/ioctl.h defines TIOCGWINSZ... yes checking for sig_atomic_t in signal.h... yes checking whether signal handlers are of type void... yes checking for TIOCSTAT in sys/ioctl.h... no checking for FIONREAD in sys/ioctl.h... yes checking for speed_t in sys/types.h... no checking for struct winsize in sys/ioctl.h and termios.h... sys/ioctl.h checking for struct dirent.d_ino... yes checking for struct dirent.d_fileno... yes checking for tgetent... no checking for tgetent in -ltermcap... no checking for tgetent in -ltinfo... no checking for tgetent in -lcurses... no checking for tgetent in -lncurses... no checking which library has the termcap functions... using gnutermcap checking wctype.h usability... yes checking wctype.h presence... yes checking for wctype.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking langinfo.h usability... yes checking langinfo.h presence... yes checking for langinfo.h... yes checking for mbrlen... yes checking for mbscasecmp... no checking for mbscmp... no checking for mbsnrtowcs... yes checking for mbsrtowcs... yes checking for mbschr... no checking for wcrtomb... yes checking for wcscoll... yes checking for wcsdup... yes checking for wcwidth... yes checking for wctype... yes checking for wcswidth... yes checking whether mbrtowc and mbstate_t are properly declared... yes checking for iswlower... yes checking for iswupper... yes checking for towlower... yes checking for towupper... yes checking for iswctype... yes checking for nl_langinfo and CODESET... yes checking for wchar_t in wchar.h... yes checking for wctype_t in wctype.h... yes checking for wint_t in wctype.h... yes checking configuration for building shared libraries... supported configure: creating ./config.status config.status: creating Makefile config.status: creating doc/Makefile config.status: creating examples/Makefile config.status: creating shlib/Makefile config.status: creating config.h config.status: executing default commands
[root@linux rlwrap-0.30]# rlwrap rlwrap: error while loading shared
libraries: libreadline.so.6: cannot open shared object file: No such file or
directory