- 论坛徽章:
- 0
|
#!/usr/bin/ksh\r\n# step 1, generate application statistics at the morning for tomorrow\r\nget_one_day_after_specified_date()\r\n{\r\n#get the command line input(date month & year)\r\nday=$1\r\nmonth=$2\r\nyear=$3\r\n#use cal get the last day this month\r\nlastday=`cal $month $year | awk \'NF != 0{ last = $0 }; END{ print last }\' | awk \'{ print $NF }\'`\r\n# if it is the last day of the month\r\nif [ $day -eq $lastday ]\r\nthen\r\n# if it is the last month of the year\r\nif [ $month -eq 12 ]\r\nthen\r\n# make the month as 01\r\nmonth=01\r\n\r\n# add the year by one\r\nyear=`expr $year + 1`\r\nelse\r\n# add the month by one\r\nmonth=`expr $month + 1`\r\nfi\r\n\r\nday=01\r\nelse\r\n# add the day by one\r\nday=`expr $day + 1`\r\nfi\r\n \r\n echo $year$month$day\r\n\r\n}\r\n\r\nYEAR_T=`date +%Y`;\r\nMONTH_T=`date +%m`;\r\nDAY_T=`date +%d`;\r\n\r\nTOMORROW=`get_one_day_after_specified_date $DAY_T $MONTH_T $YEAR_T`;\r\necho $TOMORROW\n\n[ 本帖最后由 我老婆黑社会 于 2009-7-28 16:12 编辑 ] |
|