mcainc
asked on
Shell script to print out YESTERDAY's date: MMDDYYYY
Hello all,
I have a cron job that will be renaming some mysql tables daily to back them up..
I wanted to do this from a shell script but I'm not sure how to gate 'date' to show YESTERDAYS date (since the script is run at midnight)
YESTERDAY=$(date +%m%d%Y) - todays date just fine heh
I have a cron job that will be renaming some mysql tables daily to back them up..
I wanted to do this from a shell script but I'm not sure how to gate 'date' to show YESTERDAYS date (since the script is run at midnight)
YESTERDAY=$(date +%m%d%Y) - todays date just fine heh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
YESTERDAY=$(date --date='1 day ago' +%m%d%Y)