May 06, 2005

Get console COLUMNS and LINES in shell script

Method 1
resize > /tmp/out
. /tmp/out
echo $COLUMNS $LINES
(resize command included in xterm rpm)
Method 2
stty -a | awk -F"[ ;]" '{if (NR==1) print $6" "$9}'

ref. tw.bbs.comp.linux - shell script 中,取用COLUMNS 變數的問題

Posted by pank at May 6, 2005 11:57 AM
Comments
Post a comment













Remember personal info?