[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: |
Greg Wooledge |
Subject: |
Re: What is the correct way to set up login environment in crontab? |
Date: |
Wed, 9 Nov 2011 11:41:13 -0500 |
User-agent: |
Mutt/1.4.2.3i |
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.
http://mywiki.wooledge.org/DotFiles