On Sat, 03 (06/00) at 12:19 +0000, Anton Graham <[EMAIL PROTECTED]> wrote:
> (Sorry if this is a duplicate post, I sent the original yesterday and
> never saw it myself)
>
> I have this rather ugly method of generating a directory name that is
> a date (YYYYMM). Part of the ugliness comes from having to pipe the
> output from date through awk to reduce the month by one because it
> gets called from a cron job at midnight on the first of each month.
>
> Does anybody have a cleaner method of doing this?
>
> DirName=$HOME/Mail/Archives/$(echo -e "$(date +%Y%m)" \
> | awk '{if ((($1-1)%100)==0) print $1-89; else \
> print $1-1 }')
>
>
> --
> _
> _|_|_
> ( ) * Anton Graham
> /v\ / <[EMAIL PROTECTED]>
> /( )X
> (m_m) GPG ID: 18F78541
> Penguin Powered!
---end quoted text---
Hi.
Hum, tricky one. Have you tried the -r switch for 'date'? From 'info date'
`-r FILE'
`--reference=FILE'
Display the time and date reference according to the last
modification time of FILE, instead of the current time and date.
If you set that to a file which is modified daily ...
Just an idea.
Regards
tom
--
Thomas 'tom' Berger, [EMAIL PROTECTED], http://www.mandrakeuser.org/
"Alice moving under skies
Never seen by waking-eyes"
All advice provided without warranty of any kind. I *may* be wrong ...