Bash : Whiptail
De www.yakakliker.org
Msgbox
whiptail --title "Déploiement" --fb --msgbox " Avant d'aller plus loin, veillez à avoir ces différentes informations en votre possession :" 20 100
--yesno
if (whiptail --title "Déploiement" --fb --yesno "Souhaitez vous continuer ?" 10 60);
then
echo "ok"
else
echo "Fin"
fi
Choix multiples
#Fonction 1
fct003(){
echo "Action 1"
exit $?
}
#Fonction 2
fct004(){
echo "Action 2"
exit $?
}
#Fonction 3
fct008(){
echo "Sortie du script"
exit $?
}
#Choix multiple
OPTION=$(whiptail --title "Deploiement" --fb --menu "Que souhaitez vous faire ?" 15 60 6 \
"fct003" " Action 1" \
"fct004" " Action 2" \
"fct008" " Quitter le script" 3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
$OPTION
else
fct008
fi
Inputbox
variable=$(whiptail --title "Adresse IP" --fb --inputbox "Entrez l'adresse IP ou le nom du Srv" 10 60 3>&1 1>&2 2>&3)
echo $variable
Passwordbox
variable=$(whiptail --title "Passroot" --fb --passwordbox "Entrez le mot de passe root de connexion" 10 60 3>&1 1>&2 2>&3)
echo $variable