Friday, May 4, 2007

dialog - display dialog boxes from shell scripts, a discussion

"dialog" utility is superb for developing "small" front-ends. I was aware of it , but never tried it. Some days ago I came up with some small applications using it, those looks pretty good(as per my friends views). Here I will discuss about how to program with "dialog" in BASH. To start with, first lets discuss some of the basic controls available in "dialog", later using them we will develop a simple application.


dialog --checklist "Choose OS:" 10 40 5 \
1 Linux on \
2 Solaris off \
3 "HP UX" off \
4 AIX off


dialog --title "Inputbox - Example" --backtitle "" \
--inputbox "Enter your favourite OS here" 8 60


dialog --title "A dialog Menu Example" \
--menu "Please choose the command:" 15 55 5 \
"nestat -r" "Display the kernel routing tables" \
"netstat -a" "listening / non-listening sockets" \
"/sbin/ifconfig" "configure a network interface"


dialog --title "Example Dialog message box" \
--msgbox "\n Installation Completed on" 6 50


dialog --backtitle "Flims" \
--radiolist "Select Flim:" 10 40 3 \
1 "Life is beautiful" off \
2 "Beautiful Mind" on \
3 "Walk in the clouds" off

© Jadu Saikia