Gentoo Archives: gentoo-user

From: "Boyd Stephen Smith Jr." <bss03@××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] $PATH
Date: Mon, 18 Dec 2006 03:36:48
Message-Id: 200612172132.42224.bss03@volumehost.net
In Reply to: Re: [gentoo-user] $PATH by "Jesús Guerrero" <6thpink@terra.es>
1 On Sunday 17 December 2006 16:56, Jesús Guerrero <6thpink@×××××.es> wrote
2 about 'Re: [gentoo-user] $PATH':
3 > El Sun, 17 Dec 2006 23:41:23 +0100
4 >
5 > "Boris Fersing" <kernelsensei@g.o> escribió:
6 > > You don't need to export the variable...
7 >
8 > You do, unless you plan to use that variable only instead of the
9 > script, in this case, ~/.bashrc
10
11 Not quite. An unexported variable is only available in the current shell
12 and not any subshells (or any other spawned processes). An exported
13 variable is available in both the current shell and any subshells.
14
15 source-ing a file executes those commands in the current shell environment,
16 allowing unexported variables to be seen by the script, and allowing
17 unexported varibles set by the script to be seen afterwards.
18
19 .bashrc, .bash_profile, and shell startup files in general are sourced by
20 the shell and therefore do not require a variable to be exported for the
21 user of the shell to execute it. However, these variables are normally
22 expected to be seen by subprocesses as well (e.g. shell scripts in ~/bin
23 or, for variables like LANG, internationalized programs).
24
25 --
26 "If there's one thing we've established over the years,
27 it's that the vast majority of our users don't have the slightest
28 clue what's best for them in terms of package stability."
29 -- Gentoo Developer Ciaran McCreesh