Using the full tty real estate with sqlplus

Posted by katsumii on Oracle Blogs See other posts from Oracle Blogs or by katsumii
Published on Tue, 18 Sep 2012 18:09:49 +0000 Indexed on 2012/09/18 21:46 UTC
Read the original article Hit count: 270

Filed under:

I believe 'rlwrap' is widely used for adding 'sqlplus' the history function and command line editing.
'rlwrap' has other functions and here's my kludgy alias to force sqlplus to use the full real estate of your
tty. Be it PuTTy session from Windows or Linux gnome terminal.

$ declare -f sqlplus
sqlplus ()
{
    PRE_TEXT=$(resize |sed -n "1s/COLUMNS=/set linesize /p;2s/LINES=/set pagesize /p"|while read line; do printf "%s \ " "$line";done);
    if [ -z "$1" ]; then
        rlwrap -m -P "$PRE_TEXT" sqlplus /nolog;
    else
        if ! echo $1 | grep '^-' > /dev/null; then
            rlwrap -m -P "$PRE_TEXT connect $*" sqlplus /nolog;
        else
            command sqlplus $*;
        fi;
    fi
} 




© Oracle Blogs or respective owner

Related posts about /Misc