目录
1.消息框
[root@localhost shell]# dialog --msgbox "Hello World" 9 18
2.复选框
[root@localhost shell]# dialog --title "Check me" --checklist "Pick Numbers" 15 25 3 1 "one" "o
ff" 2 "two" on 3 "three" "off"
3.询问框
[root@localhost shell]# dialog --title "Questionnaire" --msgbox "welcom to my simple survey" 9 18
4.复杂询问框
#!/bin/sh
dialog --title "confirm" --yesno "Are you willing to take part" 9 18
if [ $? != 0 ]; then
dialog --infobox "Thank you anyway" 5 20
sleep 2
dialog --clear
exit 0
fi
[root@localhost shell]# vi dialog.sh
5.复杂询问框2
#!/bin/sh
dialog --title "Questionnaire" --inputbox "Please enter your name " 9 30 2>_1.txt
Q_NAME=$(cat _1.txt)
dialog --menu "$Q_NAME,what music do you like best?" 15 30 4 1 "Classical" 2 "jeff" 3 "mary" 4 "Other" 2>_1.txt
Q_MUSIC=$(cat _1.txt)
if [ "$Q_MUSIC" = "1" ];then
dialog --title "Likes Classical" --msgbox "Good choice!" 12 25
else
dialog --title "Doesn't like Classical" --msgbox "Shame" 12 25
fi
sleep 5
dialog --clear
exit 0
[root@localhost shell]# sh dialog2.sh