On Fri, 03 Nov, 2006 at 13:15:03 -0600, Darryl Gregorash wrote:
On 2006-11-03 09:07, Jon Clausen wrote:
On 9.3 it's very much possible to set a variable that way, to wit;
Perhaps that is what is meant by "environment variables can be set in the crontab," but I took that to mean the way I mentioned.
I don't think so.
There is nothing that clearly says an environment variable can be set within a cron command.
Agreed, but then again; env VAR=value /path/to/command *is* the command. Whether or not it's acceptable to the shell is not really cron's problem.
You *can* do this:
LANG=C <cron command>
This I wasn't aware of, though.
Which wasn't wasn't strictly true, I've just never used it to set LANG :P
Yes, man 5 crontab states: "An active line in a crontab will be either an environment setting or a cron command. An environment setting is of the form, name=value."
IINM it may all be summarized to something like; If you want to set a variable for a single command in the crontab, without affecting subsequent commands, use * * * * * /path/to/unaffected * * * * * env VAR=val /path/to/command * * * * * /path/to/othercommand If you want to set a var for all subsequent commands in the crontab, use * * * * * /path/to/unaffected VAR=value * * * * * /path/to/command * * * * * /path/to/othercommand But that's all supposition... /Jon -- YMMV