[TriLUG] OT: bash scripting question

Mark Kempster mark at kempster.org
Wed Jun 25 14:51:49 EDT 2003


> I do have a question... date -d "yesterday" and date -d "tomorrow"
> works, but what's the right way to generate a date 1 week ago, or an
> arbitrary date? (30 days ago, 45 days ago, 10 days from now, etc)

[mark at anubis ~] date --version
date (coreutils) 5.0
...


I thought I had this all figured out until I ran across this one...


[mark at anubis ~] date --date="today + 10 days"
Sat Jul  5 14:41:46 EDT 2003

[mark at anubis ~] date --date="today - 10 days"
Sat Jul  5 14:42:11 EDT 2003

Can anybody explain why these two are the same?
Just a bad pattern-match somewhere?

fwiw, removing the space between +/- and 10 seems to fix things,
which is more in line with Jon's earlier example.


Confused
- Mark




More information about the TriLUG mailing list