Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-21-2013, 12:01 PM
|
#1
|
Member
Registered: Sep 2012
Posts: 372
Rep: 
|
How many lines showing in a window
In my script I want to know how many lines of data a users window is displaying.
I'm faily certain it isn't tput but my recollection is it is a short command name like that. Help?
This may require knowing the type of terminal a user has. How can I find that info?
|
|
|
09-21-2013, 12:08 PM
|
#2
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Maybe it's just tput. Have you tried it?
|
|
2 members found this post helpful.
|
09-21-2013, 09:24 PM
|
#3
|
Member
Registered: Sep 2012
Posts: 372
Original Poster
Rep: 
|
I scanned the man page and from that concluded it was used primarily to set same. There is a command sequence which is used to set terminal features which I can't remember that I was thinking was what was needed so locked in and have been reminded of tput lines. I did not see the option lines in the man page can U so direct me?
AND YES I HAVE NOW TRIED IT YEA!! --Dah! A BIG thanks for that as it is exactly what I needed.
|
|
|
09-21-2013, 09:32 PM
|
#4
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep: 
|
tput cols gets no respect, I tell ya.
|
|
|
09-21-2013, 09:43 PM
|
#5
|
Member
Registered: Sep 2012
Posts: 372
Original Poster
Rep: 
|
LOL I noted that cols when I scanned the tputs and thought it strange there was nothing for rows.
|
|
|
09-22-2013, 07:04 AM
|
#6
|
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
|
Something I've done forever is add this to the top of my ~/.profile:
Code:
# set up default columns and lines
COLUMNS=80
LINES=40
followed by some other stuff, then, the last lines of ~/.profile:
Code:
# make COLUMNS and LINES the screen size
eval `resize`
Take a look at the manual page for resize, probably get you to where you want to go.
Hope this helps some.
|
|
1 members found this post helpful.
|
09-22-2013, 08:28 AM
|
#7
|
Member
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 15.0
Posts: 648
|
Under my shell, a simple 'echo $LINES" displayed 37, then I resized the window and tried again and it displayed 25. So that shell variable would seem to contain the value dynamically.
|
|
|
09-22-2013, 11:22 AM
|
#8
|
Senior Member
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,868
Rep: 
|
I've always parsed the output of "stty -a" to get the number of rows and columns. Thanks for letting me know about tput. I never knew about that. Maybe that's because I never used ncurses. Now I won't need to parse (at least where ncurses is installed).
|
|
1 members found this post helpful.
|
09-22-2013, 03:49 PM
|
#9
|
Member
Registered: Sep 2012
Posts: 372
Original Poster
Rep: 
|
Real great ideas pplz! The one I couldn't remember was stty so double thanks for that.
|
|
|
All times are GMT -5. The time now is 12:23 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|