Command line musings: whiptail and dialog

A quick jaunt on cool command utils for ‘command line ui’ installations/prompts for those who are into that kind of stuff for configuration tools, etc;

Whiptail is a handy utility that allows you to create colorized command line dialogs that you see when configuring certain things such as postfix or zend server, etc.

For scripts that utilize this, it’s important to note the latter part of the man page. Yes/OK returns 0; No/Cancel returns 1. For internal errors/malformed command, whiptail returns -1.

Sample output:

 * Note: The “10 30” is height, and width represented in cols and rows not pixels.
Sample command:
whiptail –yesno –title “Question for you” “This is cool, no?” 10 30

Dialog is a more powerful counterpart than whiptail, much more verbose in it’s usage providing flexability.

Sample output:

Sample command:
dialog –title “Dialog title” –checklist “Instructions for dialog”, 15 60 2 \
optionA “Description for A goes here” valA \

optionB “Description for B goes here” valB

Make sure you read the man pages on the return codes for use in your various shell scripts, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *