shell根据时间发送上午下午晚上
#! /bin/bash
hour=`date +%H`
case "$hour"
in
0? |1[01] ) echo “good morning”;;
1[2-7] ) echo “good afternoon”;;
* ) echo “good evening”;;
esac
[li] ~> sh se
“good afternoon”
[li] ~> date
Fri Feb 22 14:16:38 CST 2013
#! /bin/bash
hour=`date +%H`
case "$hour"
in
0? |1[01] ) echo “good morning”;;
1[2-7] ) echo “good afternoon”;;
* ) echo “good evening”;;
esac
[li] ~> sh se
“good afternoon”
[li] ~> date
Fri Feb 22 14:16:38 CST 2013