注册
源码安装rlwrap配置,实现sqlplus下调用历史命令和退格
培训园地/ 文章详情 /

源码安装rlwrap配置,实现sqlplus下调用历史命令和退格

丁一宝 2022/12/01 812 0 0

1、下载rlwrap文件

链接链接:https://fossies.org/linux/privat/rlwrap-0.46.1.tar.gz/

[root@localhost ~]# ll rlwrap-0.46.1.tar.gz -rw-r--r-- 1 root root 340033 11月 30 18:18 rlwrap-0.46.1.tar.gz

2、安装

2.1、解压

[root@localhost ~]# tar -zxvf rlwrap-0.46.1.tar.gz rlwrap-0.46.1/ rlwrap-0.46.1/BUGS rlwrap-0.46.1/Makefile.am rlwrap-0.46.1/configure.ac rlwrap-0.46.1/ChangeLog rlwrap-0.46.1/NEWS rlwrap-0.46.1/test/ rlwrap-0.46.1/test/testclient rlwrap-0.46.1/test/testit rlwrap-0.46.1/config.h.in rlwrap-0.46.1/completions/ rlwrap-0.46.1/completions/testclient rlwrap-0.46.1/completions/coqtop rlwrap-0.46.1/aclocal.m4 rlwrap-0.46.1/INSTALL rlwrap-0.46.1/COPYING rlwrap-0.46.1/Makefile.in rlwrap-0.46.1/doc/ rlwrap-0.46.1/doc/Makefile.am rlwrap-0.46.1/doc/Makefile.in rlwrap-0.46.1/doc/rlwrap.man.in rlwrap-0.46.1/filters/ rlwrap-0.46.1/filters/paint_prompt rlwrap-0.46.1/filters/Makefile.am rlwrap-0.46.1/filters/count_in_prompt rlwrap-0.46.1/filters/null.py rlwrap-0.46.1/filters/rlwrapfilter.py rlwrap-0.46.1/filters/count_in_prompt.py rlwrap-0.46.1/filters/unbackspace rlwrap-0.46.1/filters/listing rlwrap-0.46.1/filters/edit_history rlwrap-0.46.1/filters/logger rlwrap-0.46.1/filters/RlwrapFilter.pm rlwrap-0.46.1/filters/makefilter rlwrap-0.46.1/filters/handle_sigwinch rlwrap-0.46.1/filters/ftp_filter rlwrap-0.46.1/filters/censor_passwords rlwrap-0.46.1/filters/outfilter rlwrap-0.46.1/filters/pipeline rlwrap-0.46.1/filters/README rlwrap-0.46.1/filters/simple_macro rlwrap-0.46.1/filters/Makefile.in rlwrap-0.46.1/filters/handle_hotkeys rlwrap-0.46.1/filters/null rlwrap-0.46.1/filters/template rlwrap-0.46.1/filters/handle_hotkeys.py rlwrap-0.46.1/filters/ftp_filter.py rlwrap-0.46.1/filters/dissect_prompt rlwrap-0.46.1/filters/debug_null rlwrap-0.46.1/filters/history_format rlwrap-0.46.1/filters/paint_prompt.py rlwrap-0.46.1/filters/RlwrapFilter.3pm rlwrap-0.46.1/filters/pipeto.py rlwrap-0.46.1/filters/scrub_prompt rlwrap-0.46.1/filters/logger.py rlwrap-0.46.1/filters/censor_passwords.py rlwrap-0.46.1/filters/pipeto rlwrap-0.46.1/configure rlwrap-0.46.1/src/ rlwrap-0.46.1/src/multibyte.c rlwrap-0.46.1/src/term.c rlwrap-0.46.1/src/malloc_debug.c rlwrap-0.46.1/src/Makefile.am rlwrap-0.46.1/src/malloc_debug.h rlwrap-0.46.1/src/signals.c rlwrap-0.46.1/src/rlwrap.h rlwrap-0.46.1/src/string_utils.c rlwrap-0.46.1/src/pty.c rlwrap-0.46.1/src/completion.rb rlwrap-0.46.1/src/Makefile.in rlwrap-0.46.1/src/redblack.h rlwrap-0.46.1/src/readline.c rlwrap-0.46.1/src/ptytty.c rlwrap-0.46.1/src/filter.c rlwrap-0.46.1/src/main.c rlwrap-0.46.1/src/utils.c rlwrap-0.46.1/src/completion.c rlwrap-0.46.1/tools/ rlwrap-0.46.1/tools/config.sub rlwrap-0.46.1/tools/install-sh rlwrap-0.46.1/tools/config.guess rlwrap-0.46.1/tools/test-driver rlwrap-0.46.1/tools/depcomp rlwrap-0.46.1/tools/missing rlwrap-0.46.1/tools/compile rlwrap-0.46.1/AUTHORS rlwrap-0.46.1/README.md

2.2、安装依赖、编译安装

[root@localhost rlwrap]# yum install readline* -y Last metadata expiration check: 0:18:21 ago on 2022年12月01日 星期四 16时54分07秒. Package readline-devel-7.0-13.ky10.x86_64 is already installed. Package readline-help-7.0-13.ky10.noarch is already installed. Dependencies resolved. ===================================================================================== Package Architecture Version Repository Size ===================================================================================== Installing: readline x86_64 7.0-13.ky10 ks10-adv-os 138 k Transaction Summary ===================================================================================== Install 1 Package Total download size: 138 k Installed size: 389 k Downloading Packages: readline-7.0-13.ky10.x86_64.rpm 380 kB/s | 138 kB 00:00 ------------------------------------------------------------------------------------ Total 377 kB/s | 138 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : readline-7.0-13.ky10.x86_64 1/1 Running scriptlet: readline-7.0-13.ky10.x86_64 1/1 Verifying : readline-7.0-13.ky10.x86_64 1/1 Installed: readline-7.0-13.ky10.x86_64 Complete!
[root@localhost ~]# mv rlwrap-0.46.1 /usr/local/rlwrap [root@localhost ~]# cd /usr/local/rlwrap/ [root@localhost rlwrap]# ./configure checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a race-free mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make sets $(MAKE)... (cached) yes checking whether build environment is sane... yes checking whether make supports the include directive... yes (GNU style) checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether gcc accepts -g... yes checking for gcc option to enable C11 features... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for wchar.h... yes checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking whether _XOPEN_SOURCE should be defined... no checking for gcc... (cached) gcc checking whether the compiler supports GNU C... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to enable C11 features... (cached) none needed checking whether gcc understands -c and -o together... (cached) yes checking dependency style of gcc... (cached) gcc3 checking how to run the C preprocessor... gcc -E checking for perl... /usr/bin/perl checking for strip... strip checking for sys/wait.h that is POSIX.1 compatible... yes checking for errno.h... yes checking for fcntl.h... yes checking for libgen.h... yes checking for libutil.h... no checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking for sched.h... yes checking for sys/file.h... yes checking for sys/ioctl.h... yes checking for sys/wait.h... (cached) yes checking for sys/resource.h... yes checking for stddef.h... yes checking for termios.h... yes checking for unistd.h... (cached) yes checking for stdint.h... (cached) yes checking for time.h... yes checking for sys/time.h... yes checking for getopt.h... yes checking for regex.h... yes checking for curses.h... yes checking for stropts.h... no checking for termcap.h... yes checking for util.h... no checking for term.h... yes checking for ncurses/term.h... yes checking for gcc options needed to detect all undeclared functions... none needed checking whether PROC_PIDVNODEPATHINFO is declared... no checking whether procstat_open_sysctl is declared... no checking whether procstat_getprocs is declared... no checking whether procstat_getfiles is declared... no checking whether STAILQ_FOREACH is declared... no checking argument type of tputs putc function... int checking for an ANSI C-conforming const... yes checking for pid_t... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking whether gcc needs -traditional... no checking for getopt_long... yes checking for basename... yes checking for dirname... yes checking for flock... yes checking for getopt_long... (cached) yes checking for isastream... yes checking for mkstemps... yes checking for pselect... yes checking for putenv... yes checking for readlink... yes checking for sched_yield... yes checking for setenv... yes checking for setitimer... yes checking for setsid... yes checking for setrlimit... yes checking for sigaction... yes checking for snprintf... yes checking for strlcpy... no checking for strlcat... no checking for strnlen... yes checking for system... 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... checking for pty/tty type... checking for pty.h... yes OPENPTY configure: checking for pty ranges checking for tgetent... no checking for tgetent in -ltinfo... yes checking for readline in -lreadline... yes checking for tigetnum... yes checking for readline/readline.h... yes checking whether your readline headers and library know about rl_set_screen_size... yes checking whether your readline headers and library know about rl_basic_quote_characters... yes checking whether your readline headers and library know about rl_variable_value... yes checking whether your readline headers and library know about rl_readline_version... yes checking whether your readline headers and library know about rl_executing_keyseq... yes checking whether the private symbol _rl_horizontal_scroll_mode is visble in your readline libs... yes Will rlwrap find command's working directory under /proc/<commands pid>/cwd? let's see... checking for /proc/15775/cwd/configure.ac... yes checking whether we can find command line under <opt_proc_mountpoint>/<pid>/cmdline and mirror it by overwriting our own *argv (this may take a few secs)... yes checking that generated files are newer than configure... done checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating filters/Makefile config.status: creating doc/Makefile config.status: creating src/Makefile config.status: creating doc/rlwrap.man config.status: creating config.h config.status: config.h is unchanged 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 [root@localhost rlwrap]# make make all-recursive make[1]: 进入目录“/usr/local/rlwrap” Making all in doc make[2]: 进入目录“/usr/local/rlwrap/doc” sed -e 's#@DATADIR@#/usr/local/share#' rlwrap.man > rlwrap.1 make[2]: 离开目录“/usr/local/rlwrap/doc” Making all in src make[2]: 进入目录“/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 ptytty.c: 在函数‘ptytty_control_tty’中: ptytty.c:257:9: 警告:implicit declaration of function ‘isastream’; did you mean ‘system’? [-Wimplicit-function-declaration] if (isastream(fd_tty) == 1) { ^~~~~~~~~ system 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 multibyte.o -MD -MP -MF .deps/multibyte.Tpo -c -o multibyte.o multibyte.c mv -f .deps/multibyte.Tpo .deps/multibyte.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 multibyte.o filter.o -lutil -lreadline -ltinfo make[2]: 离开目录“/usr/local/rlwrap/src” Making all in filters make[2]: 进入目录“/usr/local/rlwrap/filters” make[2]: 对“all”无需做任何事。 make[2]: 离开目录“/usr/local/rlwrap/filters” make[2]: 进入目录“/usr/local/rlwrap” make[2]: 离开目录“/usr/local/rlwrap” make[1]: 离开目录“/usr/local/rlwrap” [root@localhost rlwrap]# make install Making install in doc make[1]: 进入目录“/usr/local/rlwrap/doc” make[2]: 进入目录“/usr/local/rlwrap/doc” make[2]: 对“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]: 离开目录“/usr/local/rlwrap/doc” make[1]: 离开目录“/usr/local/rlwrap/doc” Making install in src make[1]: 进入目录“/usr/local/rlwrap/src” make[2]: 进入目录“/usr/local/rlwrap/src” /usr/bin/mkdir -p '/usr/local/bin' /usr/bin/install -c rlwrap '/usr/local/bin' make[2]: 对“install-data-am”无需做任何事。 make[2]: 离开目录“/usr/local/rlwrap/src” make[1]: 离开目录“/usr/local/rlwrap/src” Making install in filters make[1]: 进入目录“/usr/local/rlwrap/filters” make[2]: 进入目录“/usr/local/rlwrap/filters” make[2]: 对“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]: 离开目录“/usr/local/rlwrap/filters” make[1]: 离开目录“/usr/local/rlwrap/filters” make[1]: 进入目录“/usr/local/rlwrap” make[2]: 进入目录“/usr/local/rlwrap” make[2]: 对“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/edit_history filters/count_in_prompt.py filters/ftp_filter.py filters/debug_null filters/handle_sigwinch filters/outfilter filters/makefilter filters/dissect_prompt '/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]: 进入目录“/usr/local/rlwrap” chmod a+x /usr/local/share/rlwrap/filters/* make[3]: 离开目录“/usr/local/rlwrap” make[2]: 离开目录“/usr/local/rlwrap” make[1]: 离开目录“/usr/local/rlwrap” [root@localhost rlwrap]# 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> ('rlwrap -z listing' writes a list of installed filters) bug reports, suggestions, updates: https://www.github.com/hanslub42/rlwrap

2.3、配置

[root@localhost rlwrap]# vim /home/dmdba/.bashrc
# Source default setting [ -f /etc/bashrc ] && . /etc/bashrc # User environment PATH PATH="$HOME/.local/bin:$HOME/bin:$PATH" export DM_HOME="/dm8" export PATH="$DM_HOME/bin:$DM_HOME/tool:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" alias disql="rlwrap disql" alias dmrman="rlwrap dmrman"
[root@localhost rlwrap]# source /home/dmdba/.bashrc
[root@localhost bin]# disql disql V8 用户名:SYSDBA 密码: 服务器[LOCALHOST:5236]:处于普通打开状态 登录使用时间 : 4.318(ms) SQL> select name from v$database; 行号 NAME ---------- ---- 1 DM 已用时间: 2.387(毫秒). 执行号:600. SQL>
评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服