Re: [doc] LINES/COLUMNS auto-update in non-interactive shells contradicts manual
Chet Ramey <[email protected]> Thu, 14 May 2026 11:30:46 -0400
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Organization | ITS, Case Western Reserve University |
| Message-ID | <[email protected]> |
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 [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
(application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE----- wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCagXqpgUDAAAAAAAKCRC7WGnwZOp0q9t5 AJ4m6QZSor6z0rym+a7R8UaNI3CsAACfV/IsLEXHXE10q8pEZ8zVpkhI1Ww= =qiRB -----END PGP SIGNATURE-----