#! /bin/bash RESULT=$(whiptail --title "Menu" --menu "choose an option" 12 40 4 "1" "" "2" "" "3" "" 3>&1 1>&2 2>&3) case $RESULT in 1) whiptail --msgbox "YES 1" 10 40 ;; 2) whiptail --msgbox "NO 2" 10 40 ;; *) echo "WtF...!?" esac
実際にやってみると……
#! /bin/bash RESULT=$(whiptail --title "Menu" --menu "choose an option" 12 40 4 "1" "" "2" "" "3" "" 3>&1 1>&2 2>&3) case $RESULT in 1) whiptail --msgbox "YES 1" 10 40 ;; 2) whiptail --msgbox "NO 2" 10 40 ;; *) echo "WtF...!?" esac
実際にやってみると……