[svlug] Adding environment variable to a shell and it's

Roland Krause rokrau at yahoo.com
Fri May 30 16:54:48 PDT 2003


Ian, 
thanks for the advice. Unfortunately I cant/"dont want to" change the
program that gets started. Seems therefore the wrapper script is the
only way of dealing with the situation. I have this implemented and it
works fine. Should be the same in KDE and Gnome, a shell wrapper is a
shell wrapper after all. 

Under the "evil" OS there is a way to set environment variables. In the
worst case one has to relogin to make them active. Something like that
was what I was looking for. 

I am going to keep looking :-) 

Roland


--- Ian Kluft <ikluft at thunder.sbay.org> wrote:
> >From: Roland Krause <rokrau at yahoo.com>
> >Is there a way under Linux and bash/tcsh to add a environment
> variable
> >to a shell that's running noninteractively and to propagate the
> >variable to it's subprocesses? 
> >
> >Say that I have started a program from within KDE's windowmanager
> and
> >that I want this program to recognize that a certain environment
> >variable has been set that was not set when the user logged in.
> >
> >Is this possible at all? I wouldnt even mind restarting the app but
> it
> >*must* be without starting a terminal/shell/konsole etc. 
> 
> Rafael's answer of reading a configuration file is correct if you
> want
> to be able to change the environment at any time the program is
> running.
> 
> If you constrain the problem to setting the environment variables
> when
> you start the program from your GUI environment, there's a simpler
> solution.
> You could use a "wrapper script" to set the environment variables and
> then
> launch the program.  Just have your GUI environment run the wrapper
> script
> instead of the program itself.
> 
> (A wrapper script is simply a shell/perl/etc script to change the
> environment or possibly other actions before starting a program.)
> 
> Since I use Gnome, I don't know specific directions for KDE off the
> top of
> my head.  But this is true of any Unix-based GUI.  Wherever you
> specify the
> properties of the program to launch, use the wrapper script instead
> of the
> GUI program.  The wrapper script will, of course, run the GUI program
> after
> it sets the environment.
> 
> It may also be possible to set some simple variables on the command
> line
> of the program, like this:
>    VAR=VALUE program-name arguments ...

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com




More information about the svlug mailing list