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 變數的問題