|
发表于 2006-6-29 21:29:49
|
显示全部楼层
不要笑话偶哈,才学shell scripts 不超过 5*24小时,学着写的
*************************************************************
#!/bin/bash
# Let's to judge time and date
# History
# 2006/06/28 TMeng First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/scripts
export PATH
read -p "please input current date: (format mmdd ex> 0629) " cur_date
read -p "please input current time: (format hh ex> 14) " cur_time
Date=`date +%m%d`
Time=`date +%H`
if [ "$Date" != "$cur_date" ]
then
echo "The current day is $Date"
else
echo "The day is match!"
fi
if [ "$Time" != "$cur_time" ]
then
echo "The current time is $Time"
else
echo "The Time is match!"
fi
****************************************************** |
|