[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Why doesn't this work in cron?



Jeff Bearer wrote:

I'm attempting to set some variables with the output of 'date' in my
crontab but for some reason they are not being evaluated.


YESTERDAY=$(date +%Y%m%d -d yesterday) * * * * * root echo $YESTERDAY

When cron runs that $YESTERDAY is set to "date +%Y%m%d -d yesterday"
Why doesn't this work, and how do I get it to work?

On Friday, I learned from "man 5 crontab" that the % sign is treated like an end of line marker unless you escape it. I suspect that the "%" signs in the variable setting line is being similarly interpreted.

Alan

--
Alan Peery -- peery io com
Mankind is led into the darkness beyond our world by the inspiration
of discovery and the longing to understand.  Our journey into space
will go on.  -- President Bush, Feb 1 2003








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]