菜单型+case 简易选择答题 Xdialog动态加载进度脚本
2015-03-27 11:40
302 查看
#!/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
#
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
相关文章推荐
- 注册客户端脚本动态加载Flash幻灯
- 如何动态加载JS脚本 http://www.douwoo.cn/articles/2006/12/31/1_1167545707.html
- 动态加载JS脚本的4种方法
- 动态加载JS脚本的4种方法
- 动态加载Js代码到Head标签中的脚本
- 如何实现从服务器端向页面动态加载JavaScript脚本?
- 动态加载JS脚本的4种方法
- 动态加载外部 css和javascript脚本 文件
- 动态加载css样式表和javascript脚本
- 如何动态加载Javascript脚本
- 动态加载JS脚本的4种方法[转自http://hi.baidu.com/ajax] http://www.cnitblog.com/yemoo/archive/2007/07/19/30222.html
- javascript中动态加载js、vbs脚本或者css样式表
- Python动态加载脚本的方法
- JS 动态加载脚本的4种方法
- 动态加载JS脚本的4种方法
- 动态加载JS脚本的4种方法
- Ajax 动态加载 用户控件脚本报 "缺少对象" 的错误!
- 动态添加和删除文件选择框及脚本的兼容性问题。
- 动态加载图片与脚本
- 动态加载JS脚本的4种方法