On Wed, Nov 9, 2011 at 10:41 AM, Greg Wooledge <wool...@eeg.ccf.org> wrote: > On Wed, Nov 09, 2011 at 10:29:52AM -0600, Peng Yu wrote: >> I sourced my ~/.bashrc, which source some other files. It seems the >> environment variables defined in these files are not seen with env. >> Why is so? > > Without seeing the code? Impossible to say. But you're doing it backwards. > ~/.bashrc should be sourced FROM ~/.bash_profile. A login shell reads > ~/.bash_profile only, so it's the responsibility of ~/.bash_profile to > read ~/.bashrc to set up aliases, functions, shopts, and other ephemeral > shell settings that can't be inherited from the environment.
Sorry for the confusion. ~/.bash_profile is not the problem here. I have the following line in /path/programtorun.sh . ~/.bashrc In ~/.bashrc, I have ". ~/bash_some". In ~/.bash_some, I have some variable assignment VAR=blah. However, VAR is not seen in env in /path/programtorun.sh (called from cron). -- Regards, Peng