case $变量名 in
模式1)
命令序列1
;;
模式2)
命令序列2
;;
...
模式n)
命令序列n
;;
*)
默认执行的命令序列
;;
esac
day=`date +%w`
case $day in
1 )
echo "today is Monday"
;;
2 )
echo "today is Tuesday"
;;
3 )
echo "today is Wednesday"
;;
4 )
echo "today is Thursday"
;;
5 )
echo "today is Friday"
;;
6 )
echo "today is Saturday"
;;
7 )
echo "today is Sunday"
;;
* )
echo "error"
;;
esac
case
语句结构特点如下: