APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2005/03/08 dialog


© March 2005 Tony Lawrence

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 https://www.fifi.org/doc/dialog/examples


Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> dialog

1 comment


Inexpensive and informative Apple related e-books:

Take Control of iCloud

Take Control of the Mac Command Line with Terminal, Second Edition

iOS 10: A Take Control Crash Course

Take Control of Upgrading to El Capitan

Are Your Bits Flipped?




More Articles by © Tony Lawrence






Tue Mar 8 03:10:30 2005: 116   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

------------------------


Printer Friendly Version

Have you tried Searching this site?

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.

Contact us


Printer Friendly Version





The object-oriented model makes it easy to build up programs by accretion. What this often means, in practice, is that it provides a structured way to write spaghetti code. (Paul Graham)




Linux posts

Troubleshooting posts


This post tagged:

Shell



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode





SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)
www.SCOsales.com