[wplug] Managing Environment Variables
L. A. Weber
laweber at verizon.net
Mon Nov 23 19:46:20 EST 2009
Thanks for the ideas. I cannot believe something so simple is so difficult
to do! Creating multiple .bashrc files would be a bit easier than
re-editing but still will require the open-edit-close-open to put the new
values in effect.
.bash_profile is only processed once when you log in so putting variables
there would require re-logins.
Perhaps I need to see if I can figure out why the sourced changes do no
propagate to child processes as they should.
----- Original Message -----
From: "Michael Semcheski" <mhsemcheski at gmail.com>
To: "General user list" <wplug at wplug.org>
Sent: Monday, November 23, 2009 3:41 PM
Subject: Re: [wplug] Managing Environment Variables
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.
_______________________________________________
wplug mailing list
wplug at wplug.org
http://www.wplug.org/mailman/listinfo/wplug
More information about the wplug
mailing list