On Sunday 17 December 2006 16:56, Jesús Guerrero <[EMAIL PROTECTED]> wrote about 'Re: [gentoo-user] $PATH': > El Sun, 17 Dec 2006 23:41:23 +0100 > > "Boris Fersing" <[EMAIL PROTECTED]> escribió: > > You don't need to export the variable... > > You do, unless you plan to use that variable only instead of the > script, in this case, ~/.bashrc
Not quite. An unexported variable is only available in the current shell and not any subshells (or any other spawned processes). An exported variable is available in both the current shell and any subshells. source-ing a file executes those commands in the current shell environment, allowing unexported variables to be seen by the script, and allowing unexported varibles set by the script to be seen afterwards. .bashrc, .bash_profile, and shell startup files in general are sourced by the shell and therefore do not require a variable to be exported for the user of the shell to execute it. However, these variables are normally expected to be seen by subprocesses as well (e.g. shell scripts in ~/bin or, for variables like LANG, internationalized programs). -- "If there's one thing we've established over the years, it's that the vast majority of our users don't have the slightest clue what's best for them in terms of package stability." -- Gentoo Developer Ciaran McCreesh
pgp1CiswhZ58Q.pgp
Description: PGP signature

