Created
March 16, 2016 05:07
-
-
Save bfatemi/8de059e73d666ca3b938 to your computer and use it in GitHub Desktop.
Snippet to continuously grab and display the size of the console window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap 'get_window_size' WINCH # trap when a user has resized the window | |
get_window_size() { | |
_WINDOW_X=`tput lines` | |
_WINDOW_Y=`tput cols` | |
echo "X: $_WINDOW_X" | |
echo "Y: $_WINDOW_Y" | |
return 0 | |
} | |
while read ALINE | |
do | |
echo "Read: '$ALINE'" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment