LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to determine size of xterm? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-determine-size-of-xterm-4175460694/)

sysbox 05-04-2013 10:37 AM

How to determine size of xterm?
 
I want my PERL script to format it's output based on the size of the xterm it's running in. What command will tell me how many rows and columns?

EDIT: Nevermind: the output of 'resize' will produce this.

John VV 05-04-2013 05:42 PM

just a question
What is wrong with using "more" or " less" ?

jpollard 05-04-2013 10:33 PM

Quote:

Originally Posted by John VV (Post 4944988)
just a question
What is wrong with using "more" or " less" ?

It depends on what the script is doing. I wrote one once to edit forms, and thus needed the proper window size to position the fields correctly.

You can't use more/less to handle things like that.

NevemTeve 05-05-2013 08:11 AM

You can check LINES and COLUMNS environment variables.

sysbox 05-05-2013 06:39 PM

LINES and COLUMNS aren't set for me.

ntubski 05-05-2013 08:07 PM

Quote:

Originally Posted by NevemTeve (Post 4945304)
You can check LINES and COLUMNS environment variables.

They're just shell variables, not environment variables; they won't be passed to the perl script unless you export them.

Code:

~$ env | grep -E 'COLUMNS|LINES'
~$ set | grep -E 'COLUMNS|LINES'
COLUMNS=84
LINES=42
~$ export COLUMNS LINES
~$ env | grep -E 'COLUMNS|LINES'
COLUMNS=84
LINES=42



All times are GMT -5. The time now is 08:51 PM.