[lug] modifying environment variables on the fly

John Hernandez John.Hernandez at noaa.gov
Tue Apr 17 09:34:48 MDT 2001


You could toss together a set of global aliases in /etc/bashrc and/or /etc/csh.cshrc that do the job, then from the shell prompt:

% p1env

for project 1

% p2env

for project 2

-John

rm at mamma.varadinet.de wrote:
> 
> On Tue, Apr 17, 2001 at 11:07:48AM -0400, Hugh Brown wrote:
> > I am supporting a bunch of java developers that are working on several
> > projects and have to change CLASSPATH each time they switch to a different
> > project.  Is there a slick way to do this without doing export
> > CLASSPATH="blah:blah:blah...." before they begin working on a new project?
> 
> How would you want this to happen? To be effective in all programs
> executed you need to change this in the invoking shell. Since called
> programs _can't_ modify the environment of the caller you need to
> tell the calling shell about the changes in the environment (which
> is done either by calling 'export ...' or sourcing a file with the
> '.' command. When i did Java i had a set of files in my home directory
> that contained the neccessary calls to 'export ...'. Whenever i switched
> settings i would issue ' . ~/jdk1.3-env ' and everything worked ok).
> Another solution might be to write your own custom wrapper arround
> java/javac/javap etc. that sets CLASSPATH and friends accoding to
> custom settings (for example by sourcing a .jenv file in the current
> directory).
> 
>  Ralf
> 
>  (Interested in better solutions)
> 
> > Hugh
> > _______________________________________________
> > Web Page:  http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list