Link to home
Start Free TrialLog in
Avatar of mcainc
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


ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Same as above but:
YESTERDAY=$(date --date='1 day ago' +%m%d%Y)