Changing date regularly..

Hi Guys,
Plzz help me out in this!!!!!!!!!!!!!!!!

I have a file which runs in the back ground using crontab for every monday at5 P.M. The problem is inside the file ...

This is a sample content of a file

Update the current and previous week: (Sunday to Sunday)
%let wk_curr=20070930;
%let wk_prev=20070923

Here i need to change the dates regularly i.e. every week. before the job starts running on monday..

(20070923 is a sunday and also 20070930 is a sunday)

so wen the job runs for th next time, i need the dates to be like

%let wk_curr=20071007;
%let wk_prev=20070930;

there is no problem if the dates are changing within a month but in the case of last date of the month ,its not getting updated properly..

plzzz guide me in this as it s very urgent

Regards,
Anand

man date and/or http://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html from this site's FAQ section.

HI,
I checked out but am not able to find the answer..Please guide me in this

today=`date +"%Y%m%d"`
echo "$today" > /var/tmp/NEWDATEFILE
echo "current date= $today"
olddate=`cat /var/tmp/NEWDATEFILE`
echo "privious date= $olddate"
####################
#your main logic
####################

Hi Rahul,
Thanks for the reply..Have done this part but i need to the generate dates periodically.plzz help me out in this