Gentoo Archives: gentoo-user

From: Kris Kerwin <kkerwin@×××××××××.com>
To: gentoo-user@l.g.o
Cc: Alexander Veit <list@×××××××.de>
Subject: Re: [gentoo-user] Environment variables don't export from within scripts
Date: Mon, 02 Jan 2006 22:48:59
Message-Id: 200601021630.09326.kkerwin@insightbb.com
In Reply to: Re: [gentoo-user] Environment variables don't export from within scripts by Alexander Veit
1 Thanks to all for helping.
2
3 The source command did the trick, Alex.
4
5  # echo "export VARIABLE='test'" >> test_script
6         # chmod 754 test_script
7         # ./test_script
8         # echo $VARIABLE
9
10 Get's changed to:
11
12 # echo "export VARIABLE='test'" >> test_script
13         # chmod 754 test_script
14         # source ./test_script
15         # echo $VARIABLE
16
17 Thanks again.
18
19 Kris Kerwin
20
21 On Monday 02 January 2006 15:53, Alexander Veit wrote:
22 > Kris Kerwin wrote:
23 > > I'm having difficulties exporting environment variables from
24 > > within scripts. The problem doesn't seem to occur when exporting
25 > > variables from the command line.
26 >
27 > The script is executed by a subshell that has it's own environment.
28 > export does not affect the caller's environment.
29 > http://www.gnu.org/software/bash/manual/bashref.html#SEC51
30 >
31 > The source command (.) may help you.
32 > http://www.gnu.org/software/bash/manual/bashref.html#SEC56
33 >
34 >
35 > -Alex

Replies

Subject Author
Re: [gentoo-user] Environment variables don't export from within scripts Willie Wong <wwong@×××××××××.EDU>