源码安装rlwrap 0.43(为了方便使用linux下的sqlplus)
程序员文章站
2022-05-12 10:05:15
为了linux下的sqlplus方便调用历史命令和退格,安装下rlwrap,最新版本是0.43,貌似作者已经不更新了下载地址 https://fossies.org/linux/privat/rlwrap-0.43.tar.gz/下载后winscp传入到linux上,然后安装[root@localh... ......
为了linux下的sqlplus方便调用历史命令和退格,安装下rlwrap,最新版本是0.43,貌似作者已经不更新了
下载地址
下载后winscp传入到linux上,然后安装
[root@localhost db]#ll|grep rlwrap
-rw-r--r--. 1 root root 313139 jul 30 08:50 rlwrap-0.43.tar.gz
[root@localhost db]#tar -xzf rlwrap-0.43.tar.gz
[root@localhost db]#mv rlwrap-0.43 /usr/local/rlwrap
[root@localhost db]#cd /usr/local/rlwrap/
[root@localhost rlwrap]#./configure -q
configure: warning: no termcap nor curses library found
configure: error:
you need the gnu readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build
this program!
[root@localhost rlwrap]#yum -yq install readline*
loaded plugins: langpacks, ulninfo
ignored option -q, -v, -d or -e (probably due to merging: -yq != -y -q)
package readline-6.2-10.el7.x86_64 already installed and latest version
resolving dependencies
(many more lines suppressed)
installed:
readline-devel.x86_64 0:6.2-10.el7
dependency installed:
ncurses-devel.x86_64 0:5.9-14.20130511.el7_4
complete!
[root@localhost rlwrap]#./configure -q
will rlwrap find command's working directory under /proc/< commands pid>/cwd? let's see...
now do:
make (or gmake) to build rlwrap
make check for instructions how to test it
make install to install it
[root@localhost rlwrap]#make && make install
make all-recursive
make[1]: entering directory `/usr/local/rlwrap'
making all in doc
make[2]: entering directory `/usr/local/rlwrap/doc'
sed -e 's#@datadir@#/usr/local/share#' rlwrap.man > rlwrap.1
make[2]: leaving directory `/usr/local/rlwrap/doc'
making all in src
make[2]: entering directory `/usr/local/rlwrap/src'
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt main.o -md -mp -mf .deps/main.tpo -c -o main.o main.c
mv -f .deps/main.tpo .deps/main.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt signals.o -md -mp -mf .deps/signals.tpo -c -o signals.o signals.c
mv -f .deps/signals.tpo .deps/signals.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt readline.o -md -mp -mf .deps/readline.tpo -c -o readline.o readline.c
mv -f .deps/readline.tpo .deps/readline.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt pty.o -md -mp -mf .deps/pty.tpo -c -o pty.o pty.c
mv -f .deps/pty.tpo .deps/pty.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt completion.o -md -mp -mf .deps/completion.tpo -c -o completion.o completion.c
mv -f .deps/completion.tpo .deps/completion.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt term.o -md -mp -mf .deps/term.tpo -c -o term.o term.c
mv -f .deps/term.tpo .deps/term.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt ptytty.o -md -mp -mf .deps/ptytty.tpo -c -o ptytty.o ptytty.c
mv -f .deps/ptytty.tpo .deps/ptytty.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt utils.o -md -mp -mf .deps/utils.tpo -c -o utils.o utils.c
mv -f .deps/utils.tpo .deps/utils.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt string_utils.o -md -mp -mf .deps/string_utils.tpo -c -o string_utils.o string_utils.c
mv -f .deps/string_utils.tpo .deps/string_utils.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt malloc_debug.o -md -mp -mf .deps/malloc_debug.tpo -c -o malloc_debug.o malloc_debug.c
mv -f .deps/malloc_debug.tpo .deps/malloc_debug.po
gcc -dhave_config_h -i. -i.. -ddatadir=\"/usr/local/share\" -g -o2 -mt filter.o -md -mp -mf .deps/filter.tpo -c -o filter.o filter.c
mv -f .deps/filter.tpo .deps/filter.po
gcc -ddatadir=\"/usr/local/share\" -g -o2 -o rlwrap main.o signals.o readline.o pty.o completion.o term.o ptytty.o utils.o string_utils.o malloc_debug.o filter.o -lutil -lreadline -ltinfo
make[2]: leaving directory `/usr/local/rlwrap/src'
making all in filters
make[2]: entering directory `/usr/local/rlwrap/filters'
make[2]: nothing to be done for `all'.
make[2]: leaving directory `/usr/local/rlwrap/filters'
make[2]: entering directory `/usr/local/rlwrap'
make[2]: leaving directory `/usr/local/rlwrap'
make[1]: leaving directory `/usr/local/rlwrap'
making install in doc
make[1]: entering directory `/usr/local/rlwrap/doc'
make[2]: entering directory `/usr/local/rlwrap/doc'
make[2]: nothing to be done for `install-exec-am'.
/usr/bin/mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 rlwrap.1 '/usr/local/share/man/man1'
make[2]: leaving directory `/usr/local/rlwrap/doc'
make[1]: leaving directory `/usr/local/rlwrap/doc'
making install in src
make[1]: entering directory `/usr/local/rlwrap/src'
make[2]: entering directory `/usr/local/rlwrap/src'
/usr/bin/mkdir -p '/usr/local/bin'
/usr/bin/install -c rlwrap '/usr/local/bin'
make[2]: nothing to be done for `install-data-am'.
make[2]: leaving directory `/usr/local/rlwrap/src'
make[1]: leaving directory `/usr/local/rlwrap/src'
making install in filters
make[1]: entering directory `/usr/local/rlwrap/filters'
make[2]: entering directory `/usr/local/rlwrap/filters'
make[2]: nothing to be done for `install-exec-am'.
/usr/bin/mkdir -p '/usr/local/share/man/man3'
/usr/bin/install -c -m 644 rlwrapfilter.3pm '/usr/local/share/man/man3'
make[2]: leaving directory `/usr/local/rlwrap/filters'
make[1]: leaving directory `/usr/local/rlwrap/filters'
make[1]: entering directory `/usr/local/rlwrap'
make[2]: entering directory `/usr/local/rlwrap'
make[2]: nothing to be done for `install-exec-am'.
/usr/bin/mkdir -p '/usr/local/share/rlwrap'
/usr/bin/mkdir -p '/usr/local/share/rlwrap/filters'
/usr/bin/install -c -m 644 filters/readme filters/rlwrapfilter.pm filters/rlwrapfilter.3pm filters/count_in_prompt filters/pipeto filters/logger filters/null filters/unbackspace filters/pipeline filters/ftp_filter filters/handle_hotkeys filters/history_format filters/simple_macro filters/template filters/scrub_prompt filters/paint_prompt filters/censor_passwords filters/listing filters/paint_prompt.py filters/handle_hotkeys.py filters/logger.py filters/pipeto.py filters/rlwrapfilter.py filters/null.py filters/censor_passwords.py filters/count_in_prompt.py filters/ftp_filter.py '/usr/local/share/rlwrap/filters'
/usr/bin/mkdir -p '/usr/local/share/rlwrap/completions'
/usr/bin/install -c -m 644 completions/testclient completions/coqtop '/usr/local/share/rlwrap/completions'
make install-data-hook
make[3]: entering directory `/usr/local/rlwrap'
chmod a+x /usr/local/share/rlwrap/filters/*
make[3]: leaving directory `/usr/local/rlwrap'
make[2]: leaving directory `/usr/local/rlwrap'
make[1]: leaving directory `/usr/local/rlwrap'
[root@localhost rlwrap]#
添加一条别名sql到oracle用户的环境变量中并使之生效,测试后上下左右键在sqlplus中均良好使用,提升了一大截sqlplus中的代码体验
[oracle@localhost ~]$ cat .bashrc|grep sql
alias sql='rlwrap sqlplus / as sysdba'
[oracle@localhost ~]$ . .bashrc
[oracle@localhost ~]$ sql
sql*plus: release 11.2.0.1.0 production on tue jul 30 09:41:05 2019
copyright (c) 1982, 2009, oracle. all rights reserved.
connected to:
oracle database 11g enterprise edition release 11.2.0.1.0 - 64bit production
with the partitioning, olap, data mining and real application testing options
09:41:05 sys@study> select 1 from dual;
1
----------
1
elapsed: 00:00:00.00
09:41:11 sys@study> select 1 from dual;