Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Bash / Shell Scripting (http://www.programmingforums.org/forum26.html)
-   -   Window Re-sizing in bash script. (http://www.programmingforums.org/showthread.php?t=2733)

Huck Mar 12th, 2005 4:58 PM

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. :confused:

>>>>>>>>>>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<<<<<<<<<<<<<<

mackenga May 1st, 2005 6:31 PM

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.


All times are GMT -5. The time now is 7:53 PM.

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