Can you please help me? I am new in unix scripting, can you please help me? I need to get the current system date and from it, i need to deduct 5-days from that current system date and to put it in a variable. From that variable, i need to identify or get what is the "DAY" value of that deducted date.
script is like this:
curdate=`date +%Y%m%d`
deddate=`expr $curdate - 5`
echo $curdate
echo $deddate
output is:
20080710
20080705
....so, how can i get the "DAY" value of that deddate? (is it fall on sunday, monday, tuesday, etc....)
You could use/modify this perl snippet I wrote to obtain the day of the week of an arbitrary date. It will accept negative values (because the mktime() function corrects for this), so if you just subtract 5 from the current day of the month it should still work.
e.g.
Apologies for the American date format of the parameters, that was what the person who I wrote the script for wanted. :-)