`
lufeng4321
  • 浏览: 57912 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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执行即可
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics