*.Vamos a ver unos ejemplos.*
Sintaxis:
dialog –title {title} –backtitle {backtitle} {Box options}
where Box options can be any one of following
–yesno {text} {height} {width}
–msgbox {text} {height} {width}
–infobox {text} {height} {width}
–inputbox {text} {height} {width} [{init}]
–textbox {file} {height} {width}
–menu {text} {height} {width} {menu} {height} {tag1} item1}…
Vamos a ir viendo uno por uno con ejemplos:
Un ejemplo bien sencillo:
[rino@restauracion educacionit]$ cat dialog.sh #!/bin/bash dialog --title "Bienvenido" --msgbox "Se va a proceder a formatear su disco \" Para continuar presionePara abortar presione ." 10 50 #Dependiendo de lo que pusieron if [ "$?" = "255" ] then dialog --title "Borro Windows" --msgbox "Su disco ha sido formateado satifactoriamente" 10 50 else dialog --title "No Borro Windows" --infobox "Formateo en Proceso" 10 50 for(( start = 1; start <= 10; start++ )); do dialog --title 'Formateando' --infobox '$start' 5 20 ; sleep 1;clear;done fi [rino@restauracion educacionit]$
Un Ejemplito mas:
#!/bin/bash
# yesnobox.sh - An inputbox demon shell script
OUTPUT="/tmp/input.txt"
# create empty file
>$OUTPUT
# Purpose - say hello to user
# $1 -> name (set default to 'anonymous person')
function sayhello(){
local n=${@-"anonymous person"}
#display it
dialog --title "Hello" --clear --msgbox "Hello ${n}, let us be friends!" 10 41
}
# cleanup - add a trap that will remove $OUTPUT
# if any of the signals - SIGHUP SIGINT SIGTERM it received.
trap "rm $OUTPUT; exit" SIGHUP SIGINT SIGTERM
# show an inputbox
dialog --title "Inputbox - To take input from you" \
--backtitle "Linux Shell Script Tutorial Example" \
--inputbox "Enter your name " 8 60 2>$OUTPUT
# get respose
respose=$?
# get data stored in $OUPUT using input redirection
name=$(<$OUTPUT)
# make a decsion
case $respose in
0)
sayhello ${name}
;;
1)
echo "Cancel pressed."
;;
255)
echo "[ESC] key pressed."
esac
# remove $OUTPUT file
rm $OUTPUT
Otro:
[rino@restauracion educacionit]$ cat dialog1.sh #!/bin/bash OUTPUT=/tmp/input.txt >$OUTPUT dialog --inputbox "Enter your name:" 8 40 2>$OUTPUT ssh -l `echo $OUTPUT` localhost [rino@restauracion educacionit]$
Un ejemplo con barra de progreso:
[rino@restauracion educacionit]$ cat dialog2.sh #!/bin/bash dialog --title "Bienvenido" --msgbox "Se va a proceder a formatear su disco \" Para continuar presionePara abortar presione ." 10 50 #Dependiendo de lo que pusieron if [ "$?" = "255" ] then dialog --title "Borro Windows" --msgbox "Su disco ha sido formateado satifactoriamente" 10 50 else dialog --title "No Borro Windows" --infobox "Formateo en Proceso" 10 50 for i in $(seq 0 10 100) ; do sleep 1; echo $i | dialog --gauge "Formateando" 10 70 0; done fi [rino@restauracion educacionit]$
Utilizando Menu:
$ cat > smenu # #How to create small menu using dialog # dialog --backtitle "Linux Shell Script Tutorial " --title "Main\ Menu" --menu "Move using [UP] [DOWN],[Enter] to\ Select" 15 50 3\ Date/time "Shows Date and Time"\ Calendar "To see calendar "\ Editor "To start vi editor " 2>/tmp/menuitem.$$ menuitem=`cat /tmp/menuitem.$$` opt=$? case $menuitem in Date/time) date;; Calendar) cal;; Editor) vi;; esac Save it and run as: $ rm -f /tmp/menuitem.$$ $ chmod +x smenu $ ./smenu
LSST v1.05r3 > Chapter 4 > User Interface using dialog Utility - Putting it all together
http://www.cyberciti.biz/pdf/lsst/ch04sec11.html (1 of 2) [7/29/2002 6:53:01 PM]
Fuentes:
http://www.linuxjournal.com/article/2807
http://www.gsp.com/cgi-bin/man.cgi?section=1&topic=dialog
http://www.cc-c.de/german/linux/linux-dialog.php
http://criadoindomable.wordpress.com/2006/12/20/desarrollar-shell-script-con-dialog-y-xdialog/
http://linux.die.net/man/1/dialog
http://bash.cyberciti.biz/guide/An_input_dialog_box
http://www.wikilearning.com/articulo/shell_scripting_en_kde-kdialog_dialog_types/193-5
http://bash.cyberciti.biz/guide/A_progress_bar_%28gauge_box%29
http://linuxgazette.net/101/sunil.html
http://linux.byexamples.com/archives/259/a-complete-zenity-dialog-examples-1/

The Utilizando dialog y xdialog by ITRestauracion, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Hi, i think that i saw you visited my site thus i came to “return the favor”.I am attempting to find things to enhance my site!I suppose its ok to use some of your ideas!!
hey there and thank you for your information – I have definitely picked up anything new from right here. I did however expertise some technical issues using this site, since I experienced to reload the site a lot of times previous to I could get it to load properly. I had been wondering if your web host is OK? Not that I am complaining, but sluggish loading instances times will very frequently affect your placement in google and can damage your high-quality score if ads and marketing with Adwords. Well I’m adding this RSS to my email and could look out for a lot more of your respective exciting content. Make sure you update this again very soon..
Thank you!! Im working to solve the problem with the apache…
Regards
I precisely wanted to say thanks once more. I’m not certain the things that I could possibly have created in the absence of the entire techniques revealed by you on such a subject matter. It absolutely was a scary crisis for me, however , being able to see the very skilled way you dealt with it forced me to leap over fulfillment. I will be happy for the information and hope that you realize what a great job your are accomplishing instructing many people through a web site. Most likely you’ve never encountered all of us.