[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting screen size into the env?

From: Michael Parson
Subject: Re: Getting screen size into the env?
Date: Tue, 12 Aug 2008 15:12:37 -0500 (CDT)
User-agent: Alpine 1.10 (NEB 962 2008-03-14)

On Mon, 11 Aug 2008, Juergen Weigert wrote:
On Aug 07, 08 12:18:53 -0400, Mark Eichin wrote:
"Thomas Adam" <address@hidden> writes:
2008/8/7 Micah Cowan <address@hidden>:
However, if you use bash, it will set _shell_ variables, COLUMNS and
LINES, automatically. This isn't something that screen does, but bash.
Bash does _not_ export these by default, however; you'll need to do


This may work, if the screen does not get resized while it is running.
I have my screen session inside an xterm, and resize frequently.
environment variables would still reflect the old value after a resize.

Rather unportably between Unixes:

eval $(resize)

resize requires having a terminal type that actually does xterm-style
answerback, which as at best a "maybe".

When run from within screen, we guarantee you that xterm-style
answerback is honored. Screen is an xterm-compatible device.

I used to use the eval $(resize) method a lot, but at some point, the
shell I use (bash 3.2.33, atm) has an option for checking the window
size before executing any command:

shopt -s checkwinsize

I'm not sure what version introduced this feature, I only discovered it
when I re-read the man-page after one of the 3.x releases.

Michael Parson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]