Added example script showing terminal size (columns * lines)

This commit is contained in:
Doncho Gunchev 2015-10-21 22:26:37 +03:00
parent 258d487c76
commit 46dca0fea4

21
termsize.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
COLUMNS=$(tput cols)
LINES=$(tput lines)
echo "Window: ${COLUMNS}x${LINES}"
#trap 'COLUMNS=$(tput cols) LINES=$(tput lines)' WINCH
#
#while sleep 1; do
# echo "Window: ${COLUMNS}x${LINES}"
#done
winchange() {
COLUMNS=$(tput cols)
LINES=$(tput lines)
echo "Window changed to ${COLUMNS}x${LINES}"
}
trap 'winchange' WINCH
echo "Press any key to exit."
read -e -n 1 -s