How do I find the width & height of a terminal window?
tput cols
tells you the number of columns.tput lines
tells you the number of rows.
In bash, the $LINES
and $COLUMNS
environmental variables should be able to do the trick. The will be set automatically upon any change in the terminal size. (i.e. the SIGWINCH signal)