======== Utilisation de dialog ======== [http://translate.google.com/translate?hl=fr&sl=auto&tl=fr&u=http%3A%2F%2Flinuxcommand.org%2Flc3_adv_dialog.php| Commande Dialog]] [[http://www.delafond.org/traducmanfr/man/man1/dialog.1.html|man dialog en Français]] [[https://ftp.traduc.org/doc-vf/gazette-linux/html/2004/101/lg101-P.html|doc dialog en francais]] [[https://github.com/tolik-punkoff/dialog-examples/archive/refs/heads/master.zip|Exemples Dialog sur github FR ]] [[https://github.com/tolik-punkoff/dialog-examples|Lien Github ]] {{ :start:rasberry:dialog.pdf |man dialog EN }} {{ :start:rasberry:dialogfr.pdf |Man dialog FR}} ===== exemples 001 ===== [[https://ftp.traduc.org/doc-vf/gazette-linux/html/2004/101/lg101-P.html|Exemples de scripts dialog ]] [[http://www.fifi.org/doc/dialog/examples/|Des exemples de scripts pour dialog]] #!/bin/bash cmd=(dialog --separate-output --checklist "Select options:" 22 76 16) options=( 1 "Check disk space" on 2 "List users currently logged in" off 3 "Show system uptime" off ) choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) clear for choice in $choices do case $choice in 1) df -h ;; 2) who ;; 3) uptime ;; esac done ==== Rendre executable le script et le lancer ==== chmod +x disk_check.sh ./disk_check.sh ===== Exemples 002 ===== #!/bin/bash DIALOG=${DIALOG=dialog} fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ trap "rm -f $fichtemp" 0 1 2 5 15 $DIALOG --clear --title "Mon chanteur français favori" \ --menu "Bonjour, choisissez votre chanteur français favori :" 20 51 4 \ "Brel" "Jacques Brel" \ "Aznavour" "Charles Aznavour" \ "Brassens" "Georges Brassens" \ "Nougaro" "Claude Nougaro" \ "Souchon" "Alain Souchon" \ "Balavoine" "Daniel Balavoine" 2> $fichtemp valret=$? choix=`cat $fichtemp` case $valret in 0) echo "'$choix' est votre chanteur français préféré";; 1) echo "Appuyé sur Annuler.";; 255) echo "Appuyé sur Echap.";; esac La logique est exactement la même que pour la fenêtre d'entrée. Nous redirigeons le choix que vous avez fait vers un fichier temporaire, puis nous traitons la valeur de retour de dialog et le contenu du fichier temporaire.