mirror of
https://github.com/gunchev/home_bin.git
synced 2025-11-20 12:15:46 +00:00
Added example script showing terminal size (columns * lines)
This commit is contained in:
parent
258d487c76
commit
46dca0fea4
1 changed files with 21 additions and 0 deletions
21
termsize.sh
Executable file
21
termsize.sh
Executable 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue