ターミナルの取り扱い
画面の幅・高さ
COLUMNS
LINES
stty size
tput cols
tput lines
参考:
How to find width and height of the terminal in linux – Lintel Technologies Blog
How do I find the width & height of a terminal window? – Stack Overflow
How to set Cols and Lines for a Subprocess – Unix & Linux Stack Exchange
COLUMNS
参考:
How do I get more than 80 columns in command line mode? – Ask Ubuntu
tput
参考:
tput を理解する | IBM developerWorks
Discover tput – Learn AIX and UNIX | IBM Developer
tput: Portable Terminal Control | gnu.org
Colours and Cursor Movement With tput | The Linux Documentation Project
tput で画面の幅や高さが取れないケース
Bash で環境変数を設定させる
$ shopt -s checkwinsize
xterm のウィンドウサイズを環境変数に設定させる
$ resize
参考:
tput cols doesn’t work properly in a script – Stack Overflow
The Shopt Builtin – Bash Reference Manual | gnu.org
resize (1) | invisible-island.net
stty
幅と高さを取得する
$ stty size
幅と高さを設定する
$ stty cols 106 rows 27
参考:
Set Linux Terminal Console Column Width | The Linux Daily
How to change the width of remote serial console? – Unix & Linux Stack Exchange
Set Linux Console Height and Width | Notes on Linux
Python
参考:
Get current terminal size on Linux, Mac, and Windows – GitHub Gist
jkonecny12/Python-helper-scripts: My personal helper scripts for Python 3 – GitHub