Re: [doc] LINES/COLUMNS auto-update in non-interactive shells contradict
From:
Chet Ramey
Subject:
Re: [doc] LINES/COLUMNS auto-update in non-interactive shells contradicts manual
Date:
Thu, 14 May 2026 11:30:46 -0400
User-agent:
Mozilla Thunderbird
On 5/12/26 12:58 PM, Robert Elz wrote:
So a user (or script) can just do
tsize() { set -- $(stty size); rows=$1 cols=$2; }
trap tsize WINCH
tsize
Scripts could always do this with LINES and COLUMNS. The OG way is to use
something like this:
tsize() { eval `resize -u`; }
trap tsize WINCH
tsize
This is what we all used to use in the earlier X11 days. `resize' gives
you output like
$ resize
COLUMNS=80;
LINES=30;
export COLUMNS LINES;
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/