LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-14-2004, 09:48 AM   #1
alex.e.c
LQ Newbie
 
Registered: Aug 2003
Location: London, Engerland
Distribution: Debian (kernel 2.6.0)
Posts: 14

Rep: Reputation: 0
Question How can a bash script findout the width of the terminal window


Can anyone tell me how to find out what the width of a bash terminal window (such as a xterm) in a shell (well tcl) script? This would be really helpful for me!
 
Old 10-14-2004, 10:20 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Using bash you could use COLUMNS.

$ echo $COLUMNS will return the width of the terminal.

I'm not a TCL user so I don't know if there is a simular option. I do know enough to know that you can use linux/unix commands inside TCL.

Hope this helps.
 
Old 10-14-2004, 11:20 AM   #3
alex.e.c
LQ Newbie
 
Registered: Aug 2003
Location: London, Engerland
Distribution: Debian (kernel 2.6.0)
Posts: 14

Original Poster
Rep: Reputation: 0
Yeah, and columns too. But.. they must be exported so...

Code:
sh % export LINES COLUMNS

sh % tclsh
% puts $env(LINES)
102
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab width in Bash - how do I set it benr77 Linux - General 8 12-04-2012 10:53 AM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
bash script - open new window running a command zippity Linux - Newbie 1 07-13-2004 11:16 AM
Scripting question: the width of the terminal window Bebo Programming 13 11-06-2003 04:41 PM
Changing Text Size/Terminal Width in Bash TastyWheat Linux - General 2 11-02-2003 11:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration