実際のところ
www.linuxcommand.org
を写経し一部改造しつつ実験。
#!/bin/bash redraw() { local str width height length width=$(tput cols) height=$(tput lines) str="Width = $width Height = $height" length=${#str} clear tput cup $((height / 2)) $(((width / 2) - (length / 2))) echo "$str" tput cup $((height / 2 + 1)) $(((width / 2) - (length / 2))) tput smul; echo "And you?" tput rmul } trap redraw WINCH redraw while true; do : done
実行してみると
SIGWINCHをtrapしたことで、変形後の値を読み取って