[wplug] Managing Environment Variables

Michael Semcheski mhsemcheski at gmail.com
Mon Nov 23 15:41:29 EST 2009


On Mon, Nov 23, 2009 at 3:11 PM, Weber, Lawrence A
<Lawrence.Weber at ansaldo-sts.us> wrote:
> Currently I have to edit .bashrc, close the terminal, then reopen the
> terminal.  Also not a great way.

Perhaps the only thing to do is keep a couple of different .bashrc
scripts, or have .bashrc source another script which has the
variables.  Then, shuffle around that script so that the right one is
in place at the right time.

I like the way Python virtualenv, works.  Basically, you run a script
called activate, which updates your path (and potentially sets
environment variables too.)  When you call deactivate, it reverts your
environment variables to the way things were before you ran activate.
But this seems like it might be problematic if your bash child
processes are not respecting the exported environment and instead
looking at .bashrc.

Its also worth noting that there are differences between .bashrc and
.bash_profile.  I believe .bashrc gets called every time you open a
shell, but .bash_profile only gets called when you open a login shell.
 So you might move things out of .bashrc and into .bash_profile if
they're getting overwritten.


More information about the wplug mailing list