bug-bash
[Top][All Lists]
Advanced

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

Re: What is the correct way to set up login environment in crontab?


From: Eric Blake
Subject: Re: What is the correct way to set up login environment in crontab?
Date: Wed, 09 Nov 2011 10:15:47 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15

On 11/09/2011 10:14 AM, Peng Yu wrote:
variable assignment VAR=blah.

That sets up a bash-local variable. If you want it to be exported to the environment visible to child processes, then you _also_ need to use export, as in either:

VAR=blah
export VAR

or

export VAR=blah


However, VAR is not seen in env in /path/programtorun.sh (called from cron).

Right - bash maintains two sets of variables, and only the exported ones are visible to children.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]