LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Expored variables (https://www.linuxquestions.org/questions/linux-general-1/expored-variables-269640/)

kamransoomro84 12-23-2004 01:09 PM

Expored variables
 
Can anyone explain to me what the difference between exported variables and normal variables is?

Moy Easwaran 12-26-2004 06:25 PM

Exported variables are available to child processes, unexported variables are not.

Code:

[moy@becket ~/test/foo]$ cat > foo.sh << EOF
> echo \$foo
> EOF
[moy@becket ~/test/foo]$ chmod u+x foo.sh
[moy@becket ~/test/foo]$ cat foo.sh
echo $foo
[moy@becket ~/test/foo]$ foo=abcd
[moy@becket ~/test/foo]$ ./foo.sh

[moy@becket ~/test/foo]$ export foo
[moy@becket ~/test/foo]$ ./foo.sh
abcd
[moy@becket ~/test/foo]$



All times are GMT -5. The time now is 10:09 AM.