(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



2005/03/08 dialog

Dialog adds dialog boxes to shell scripts, providing such things as menus, input boxes and even calendars. This uses TABS and arrows to move about, and sometimes keyboard style h,j,k,l. The calendar returns Day/Month/Year, which could trip up American users.

Here's a simple calendar:

result=`dialog --stdout --title "CALENDAR" --calendar "Please choose a date..." 0 0`
clear
echo $result
 

That will let you select a date from a calendar displayed on the screen.



A progress gauge:

files=`ls -l | wc -l`
copied=1
(
while [ $files -gt $copied ]
do
  pct=$((100 * copied / $files))
  echo $pct
  copied=$((copied + 1))
  sleep 1
done
) | dialog --title "Files tested" --gauge "" 5 30 
 

That shows a gauge that changes as the script runs.

You can find more examples at http://www.fifi.org/doc/dialog/examples




Click here to add your comments





Tue Mar 8 03:10:30 2005: Subject:   bruceg


I have been creating some TUI for friends, to help me with my shell scripting, and I had come across dialog a few weeks ago. It really sped up some of my development for my TUI's, since before I found dialog, I was hand coding in colored menus, and it was a pain trying to line everything up, so it looked neat on the screen for the user. dialog is a great little TUI helper, and seems to be very capable.

I really wish all Linux distro's, especially Redhat, since Suse has a nice TUI with YAST, would have a TUI for all of the configuration programs. Although I mostly hand edit files, having a TUI can help when you are not very familiar with the config file for a particular program, or sometimes more that one file needs to be changed, like in the case of a hostname change or something similar.

Having a TUI for making system configuration changes other than a GUI, is real nice, especially if you are using a cell phone to dial in, or worse, a modem. Not to mention, if you have a system that does not have a lot of disk space, and X is not even installed, a TUI may be the only option for some system admin tasks.

It also helps to have Junior sysadmins get used to using text mode, and to stop reaching for the mouse :-)

--BruceGarlock

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!



 I sell and support
 Kerio Mail server




pavatar.jpg
More:
       - Shell


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress