procmail
[Top] [All Lists]

getting yesterday's date

1996-10-26 12:25:07
Mika Dukat had posted,

D> The following may not be pretty, but I believe (knock wood) that it
D> should work.  The date command is capable of generating a date
D> /relative/ to today.  So, in order to delete yesterday's folder,
D> you could simply add the following to your action:
D>     rm -f PG/Backup-`date -d '-1 day' +'%M-%d'`;

Alan Stebbens responded,

S> Uh, which version of "date" are you using?  Perhaps GNU date does
S> this, but not most "standard" vendor date commands.

Yes, GNU date does have that feature, and Alan is right that it's the
exception.

For other versions of date, you can often trick out yesterday's date by
playing with the TZ variable:

  `TZ=WTZ23 date +'%M-%d'`

["WTZ" are just three letters I picked out to hold the places, standing for
 `whatever time zone.']

<Prev in Thread] Current Thread [Next in Thread>