Figuring out yesterday's date within a script
Hello there,
I'm writing a script right now and in order for it to work properly I need to figure out what yesterdays date was. Currently I'm using:
DATE=`expr $(DATE +%d) - 1`
This is fine and dandy until its the first of the month. The DATE variable will be 0 and I would like it to be the date it was before, such as 31, not 0. Get what I'm trying to say? Is there any work around for this rather than me hard coding this into my script? I looked at the switches for "date" and I didn't see anything.
Thanks,
Chris Koniecny
|