Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 12th, 2005, 3:58 PM   #1
Huck
Newbie
 
Join Date: Mar 2005
Posts: 1
Rep Power: 0 Huck is on a distinguished road
Question Window Re-sizing in bash script.

I'm new to programming in general & just started learning bash.

I'm asking if its possible to add code to a bash shell script to automatically re-size the window when the script is run, if not what shell should i be using?

If you could point me in the direction of a tutorial that can show me how or simply show me an example if you could.

Basically the script refreshes echoed information every 5 seconds & i want the window to resize itself to an appropriate size to view all info, which is roughly half the screen.

>>>>>>>>>>Also I would like the script to detect whether the user is "root" or not as the echoed info is different from being ran by a user to root.

Hope You can help
Cheers.
>>>>>>>>>>>> Know of any good books for a beginner, let me know<<<<<<<<<<<<<<
Huck is offline   Reply With Quote
Old May 1st, 2005, 5:31 PM   #2
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 446
Rep Power: 10 mackenga is on a distinguished road
First up, you can't resize the window from bash as far as I know. To do that, you really need something that isn't just running in a terminal window - you might fancy taking a look at Tcl/Tk (see http://tcl.activestate.com/ and http://www.beedub.com/book/ for a book on it). It's an interpreted language, high-level enough to be very like a shell to program, and you can build GUIs and do graphics (albiet a little slowly) to your heart's content with it. I won't ramble on, but I love it

As for your checking if you're root; the script is running as root if your effective user ID is zero, which is probably the best way of checking since roots may have various names . I forget exactly how you do that though in the shell. Another method would be to see with `whoami` - most Unix-like systems will support that command.
mackenga is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:58 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC