[lug] Creating date variables in bash
Shannon Johnston
sjohnston at cavionplus.com
Tue Oct 12 10:55:41 MDT 2004
I did it with this:
DATE=`date '+%Y-%m-%d'`
YESTERDAY=`date +%Y-%m-%d -d "-1 day"`
Hope that helps.
Shannon Johnston
On Tue, 2004-10-12 at 10:47, Bill Thoen wrote:
> 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
>
>
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
--
Shannon Johnston <sjohnston at cavionplus.com>
Cavion Plus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20041012/3010fb66/attachment.pgp>
More information about the LUG
mailing list