Programming Forums
User Name Password Register

RSS Feed

Thread Tools Display Modes
Old Mar 12th, 2005, 4:58 PM   #1
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
>>>>>>>>>>>> Know of any good books for a beginner, let me know<<<<<<<<<<<<<<
Huck is offline   Reply With Quote
Old May 1st, 2005, 6:31 PM   #2
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 446
Rep Power: 13 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 and 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


« 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 2:39 AM.

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