以下的腳本用了數字的比較。
以下腳本放在周日用cron來執行,如果星期的數是偶數的話,就提醒把垃圾箱清理一下。
#!/bin/bash
# Calculate the week number using the date command:
weekdate=$[ $(date +"%V") % 2 ]
# Test if we have a remainder. If not, this is an even week so send a message.
# Else, do nothing.
if [ $weekdate -eq "0" ]; then
echo "Sunday evening, put out the garbage cans." | mail -s "laji qing li"
<a href="mailto:your@your_domain.org">your@your_domain.org</a>
fi
打開郵件如下圖:
日期可以自己定。
供學習!!!
本文轉自 zhangzj1030 51CTO部落格,原文連結:http://blog.51cto.com/tech110/233914