I'm trying to write a script in that need to compute date-1 and date+1 after
reading the Date from variable
echo 2017-09-30
| read YYYY MM DD
how to print next date as 2017-10-01 trying on AIX OS .
This is the piece of code from it
date ()
{
DAY=$D1
TODAY=$D1
DAY1=$D1
echo $DAY1| read YYYY MM DD
let DD=DD+1
DD=`printf %02d $DD`
if [[ $DD -eq 0 ]] then
let MM=MM-1
MM=`printf %02d $MM`
if [[ $MM -eq 0 ]] then
let YYYY=YYYY-1
let MM=12
let DD=31
fi
DD=`cal $MM $YYYY|grep . |fmt -1|tail -1`
fi
NEXTDAY=`echo $YYYY-$MM-$DD`
echo $NEXTDAY
}