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