代码: [/home/javalee/myshell]cat hello #!/bin/ksh #脚本名:hello #描述:定时提醒用户是否该休息啦.....:-} #作者:javalee #日期:2003/9/20 function _time { n=1 while ((n<600)) do sleep 1 ((n+=1)) done }
while true do _time info="$USERNAME\n你该休息休息啦~~ :) " tishi="提示信息" xdialog --title $tishi --beep --msgbox $info 10 10 xdialog --title $tishi --no-buttons --beep --inputbox "休息吗[y/n]?" 4 20 2>tmp$$ input=$(cat tmp$$) case $input in y) break ;; n) continue;; *) xdialog --title $tishi --no-buttons --infobox "错误的选择!" 4 20;continue;; esac rm tmp$$ done |