![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2005
Posts: 1
Rep Power: 0
![]() |
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<<<<<<<<<<<<<< |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|