[lug] Creating date variables in bash

Bill Thoen bthoen at gisnet.com
Tue Oct 12 10:47:08 MDT 2004

I can get today's date into a bash variable like so:

D=$(date +%G%m%d)

but how do I get the date for say, 7 days ago?

I tried 'man date' but didn't see an option for doing date math.

- Bill Thoen

More information about the LUG mailing list