[20140415]靈活定製sqlplus的linesize.txt

lfree發表於2014-04-15

[20140415]靈活定製sqlplus的linesize.txt

各種顯示器以及開啟視窗的大小都是變化的,如果能即時修改linesize引數自動適應這種變化,那是最好的。

在linux執行:
$ stty -a
speed 38400 baud; rows 68; columns 237; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -cdtrdsr
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

--columns 237 就是當前的列寬度,如果設定這個引數,正好滿足需要。
--參考連結http://berxblog.blogspot.com/2009/07/linesizesql.html,自己修改一點。

-- linesize.sql
--
--
-- set linesize according to stty
-- handle with care, as stty is not consistent over platform boundaries
--

set termout off

define _linesize_cmd1 = 'echo -n "set linesize " > /tmp/linesize.sql '
-- for solaris:
-- define _linesize_cmd2 = 'stty -a  | awk -F''[ ;]'' ''/columns/ { print $7 }'' >>/tmp/linesize_&mycpid..sql'
-- for linux:
define _linesize_cmd2 = 'stty -a  | awk -F''[ ;]'' ''/columns/ { print $9 }'' >>/tmp/linesize.sql'

HOST &_linesize_cmd1
HOST &_linesize_cmd2

@ '/tmp/linesize.sql'

undef _linesize_cmd1 _linesize_cmd2

set termout on

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1142197/,如需轉載,請註明出處,否則將追究法律責任。

相關文章