红联Linux门户
Linux帮助

linux脚本之提醒程序员及时来起身动一下

发布时间:2017-08-02 10:12:43来源:linux网站作者:seenloveliu
将这段代码保存,然后运行即可,就可以实现一个半小时,电脑右上角弹出来一个框提示您辛苦了需要休息的对话框消息。
 
代码如下:
 
#!/bin/bash
#while true
#do
realtime=`date +%H:%M`
#echo "这条提供关键信息,时间为$realtime" 
if test $realtime != "14:32"
then
#就在这里写for循环
for((i=1;i<=1000;i++))
do
randtime=`date +%s`
let randtime=randtime%5
sleep 4800s
#echo "大家好我是一个打印程序,随机了${randtime} 秒"
notify-send "提醒通知" “你已经俯案太久,需要休息”
done
else
echo "没有进入到主程序"
fi  
#done
 
本文永久更新地址:http://www.linuxdiyf.com/linux/32201.html