1.Backspace出現亂碼在Linux指令行下輸入 stty erase^h 即可。
2.方向鍵出現亂碼,如 SQL> ^[[A^[[B^[[D^[[C^[[B^[[D^[[A^H^H。
此時,需要下載下傳兩個免費軟體 readline和rlwrap(我下載下傳的是readline-6.1.tar.gz和rlwrap-0.30.tar.gz)。
下載下傳完成後在Linux系統下解壓、編譯、安裝。
例如安裝readline,在Linux指令行下輸入:tar -zxvf readline-6.1.tar.gz (解壓安裝包)
cd readline-6.1 (進入解壓後的目錄下)
./configure (生成 makefile)
make (編譯代碼)
make install (安裝軟體)
安裝rlwrap方法同上。(注意:安裝軟體需要在超級管理者權限下)
安裝完上述兩個軟體之後,為了以後便于使用rlwrap,在運作使用者目錄下的 .bashrc下添加兩條語句。
Linux指令行下輸入:vim .bashrc
進入到可編輯模式,添加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman' 兩條語句。
最後,重新加載環境變量即可,在Linux指令行下輸入:. ./.bashrc。
如果沒有.bashrc,修改.bash_profile或者.profile檔案,方法同上。
sqlplus下方向鍵亂碼解決,可以友善的敲指令啦!
PS:rlwrap—rlwrap is a readline wrapper, a small utility that uses the GNU readline library to allow the editing of keyboard input for any other command. It maintains a separate input history for each command, and can TAB-expand words using all previously seen words and/or a user-specified file.
readline 是一個強大的庫,隻要使用了它的程式,都可以用同一個配置檔案配置,而且用同樣的方法操作指令行,讓你可以友善的編輯指令行。