首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

AIX系统上判断日期是否是月末的程序

2012-07-15 
AIX系统下判断日期是否是月末的程序. /home/racky/.profileDT1$1 #接收输入的时间参数,格式YYYYMMDDyear

AIX系统下判断日期是否是月末的程序
. /home/racky/.profile
DT1=$1 #接收输入的时间参数,格式YYYYMMDD

year=`echo $DT|cut -c1-4`
month=`echo $DT|cut -c5-6`
day=`echo $DT|cut -c7-8`

#取当前月末天,取得$year年$month月的月末天
monthend=`cal $month $year | xargs | awk '{print $NF}'`
echo $monthend
today=$day
#today=`date +%d`
echo $today

if [ $today -eq $monthend ]
then
   echo "$DT the month end"
   echo "月末"
else
   echo "$DT not the month end"
   echo "不是月末"
fi


chmod u+x monthend.sh,修改脚本的执行权限
./monthend.sh 20091213执行即可

热点排行