#!/bin/sh
echo "输入要启动的程序名称:"
read application
echo -n "输入程序启动时间(小时):"
read plan_hours
if [ "$plan_hours" -gt 23 ]; then
echo "输入小时数不能大于23!"
exit 1
fi
if [ "$plan_hours" -lt 0 ]; then
echo "输入小时数不能为负数!"
exit 1
fi
echo -n "输入程序启动时间(分钟):"
read plan_minutes
if [ "$plan_minutes" -gt 59 ]; then
echo "输入分钟数不能大于59!"
exit 1
fi
if [ "$plan_minutes" -lt 0 ]; then
echo "输入分钟数不能为负数!"
exit 1
fi
plan_time=`echo -n "$plan_hours";echo -n "$plan_minutes"`
clear
while true
do
hour=`date +"%H"`
minutes=`date +"%M"`
seconds=`date +"%S"`
time1=`echo -n "$hour";echo -n "$minutes"`
clear
echo -n "现在的时间为:"
echo -n $hour
echo -n :
echo -n $minutes
echo -n :
echo -n $seconds
sleep 1
if [ "$time1" -eq "$plan_time" ]; then
echo "程序启动..."
$application
exit 0
fi
done
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |