#!/bin/bash
#
clear
show_usage()
{
echo "------------------------menu-----------------"
echo " today is ?"
echo " "
echo " A.monday "
echo " B.thurseday"
echo " C.sunday"
echo " D. wenesday"
echo -n " select: "
read choice
}
case $choice in
*)
show_usage
;;
esac
if [ "$choice" == A ]
then
echo "right,continue"
else
echo "error.countinue"
fi
sleep 5
#
echo "------------------------menu-----------------"
echo " today is ?"
echo " "
echo " A.monday "
echo " B.thurseday"
echo " C.sunday"
echo " D. wenesday"
echo -n " select: "
read choice
case $choice in
1) echo "yes,good"
;;
*) echo "sorry,少年要再接再厉哈!"
;;
2.第二种
#!/bin/bash
#
clear
echo " --------------------menu----------------"
echo
echo " 1.find files modified in last 24 hours"
echo " 2.the free disk space"
echo " 3.space consunmed by this user"
echo " 4.exit"
echo
echo -n " select:"
read choice
case $choice in
1)find $home -mtime -l -print;;
2)df;;
3)du -s $home;;
4)exit;;
*)echo "invalid option"
esac
3.Xdialog动态加载进度
#!/bin/bash
#
dialog --yesno "DO you what you need?" 12 36
choose=$?
#
if [ $choose -ne 0 ]
then
answer=no
else
answer=yes
fi
#
default=no
if [ $answer = $default ]
then
dialog --msgbox "stop continue " 8 24
else
dialog --yesno "are you true?" 8 24
echo
echo "please wait"
sleep 1
#
{
for ((x=1;x<=100;x++))
do
let X=10*x
echo $X
sleep 1
if [ $X -eq 100 ]
then
echo
exit 0
fi
done
} |
dialog --gauge "rate of progress..." 10 36
fi
echo
exit 0