Export to Environment in Scripts

Les Mikesell lesmikesell at gmail.com
Sat May 7 19:40:38 UTC 2005


On Sat, 2005-05-07 at 12:08, David Cary Hart wrote:
> I'm trying to export a variable to the environment and then test against
> the environment variable the next time the script is run.
> 
> While I can do this from the command line, when export is called from a
> script it doesn't show up in printenv. What am I doing wrong?

Environment settings can only be inherited.  You must make sure that
the variable is used in the same shell or a process started by
the shell that exported it.  If you want all your processes to
see a setting you must set it in your login shell or in a
file sourced by subshells as they start (i.e. your .bashrc).

-- 
  Les Mikesell
   les at futuresource.com





More information about the fedora-list mailing list