What does “export” do?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I never understand what "export" does. For example, what's the difference between these two?
PYTHONPATH=/home/myaccount/ & export PYTHONPATH
andPYTHONPATH=/home/myaccount/
One with export and the other without.
environment-variables
add a comment |
I never understand what "export" does. For example, what's the difference between these two?
PYTHONPATH=/home/myaccount/ & export PYTHONPATH
andPYTHONPATH=/home/myaccount/
One with export and the other without.
environment-variables
add a comment |
I never understand what "export" does. For example, what's the difference between these two?
PYTHONPATH=/home/myaccount/ & export PYTHONPATH
andPYTHONPATH=/home/myaccount/
One with export and the other without.
environment-variables
I never understand what "export" does. For example, what's the difference between these two?
PYTHONPATH=/home/myaccount/ & export PYTHONPATH
andPYTHONPATH=/home/myaccount/
One with export and the other without.
environment-variables
environment-variables
edited Jan 30 '14 at 9:06
Flyk
1,38931624
1,38931624
asked Jul 20 '12 at 3:48
ShenShen
13327
13327
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
If you don't export, then the environment variable will only be visible locally. Exporting makes them available to other programs and shells you might launch (from that shell).
add a comment |
"Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.
It does not make it available everywhere in the system, only by processes created from that shell.
Here is an example you can try to prove the point.
("set" will list all the variables set in the terminal)
$ ZZZ=test
$ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
$ set |grep ZZZ # You will not see ZZZ=test
$ exit # Lets get out of the subshell and try export!
$ export ZZZ
$ bash
$ set |grep ZZZ # and there we go! our variable is set in the subshell/process.
You can open another terminal, and see that it is not set there, however.
http://ss64.com/bash/export.html
Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.
– Shen
Jul 20 '12 at 5:49
add a comment |
protected by Sergiy Kolodyazhnyy Feb 12 at 11:04
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you don't export, then the environment variable will only be visible locally. Exporting makes them available to other programs and shells you might launch (from that shell).
add a comment |
If you don't export, then the environment variable will only be visible locally. Exporting makes them available to other programs and shells you might launch (from that shell).
add a comment |
If you don't export, then the environment variable will only be visible locally. Exporting makes them available to other programs and shells you might launch (from that shell).
If you don't export, then the environment variable will only be visible locally. Exporting makes them available to other programs and shells you might launch (from that shell).
edited Jul 20 '12 at 5:34
answered Jul 20 '12 at 4:10
JazzJazz
1,79631934
1,79631934
add a comment |
add a comment |
"Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.
It does not make it available everywhere in the system, only by processes created from that shell.
Here is an example you can try to prove the point.
("set" will list all the variables set in the terminal)
$ ZZZ=test
$ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
$ set |grep ZZZ # You will not see ZZZ=test
$ exit # Lets get out of the subshell and try export!
$ export ZZZ
$ bash
$ set |grep ZZZ # and there we go! our variable is set in the subshell/process.
You can open another terminal, and see that it is not set there, however.
http://ss64.com/bash/export.html
Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.
– Shen
Jul 20 '12 at 5:49
add a comment |
"Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.
It does not make it available everywhere in the system, only by processes created from that shell.
Here is an example you can try to prove the point.
("set" will list all the variables set in the terminal)
$ ZZZ=test
$ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
$ set |grep ZZZ # You will not see ZZZ=test
$ exit # Lets get out of the subshell and try export!
$ export ZZZ
$ bash
$ set |grep ZZZ # and there we go! our variable is set in the subshell/process.
You can open another terminal, and see that it is not set there, however.
http://ss64.com/bash/export.html
Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.
– Shen
Jul 20 '12 at 5:49
add a comment |
"Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.
It does not make it available everywhere in the system, only by processes created from that shell.
Here is an example you can try to prove the point.
("set" will list all the variables set in the terminal)
$ ZZZ=test
$ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
$ set |grep ZZZ # You will not see ZZZ=test
$ exit # Lets get out of the subshell and try export!
$ export ZZZ
$ bash
$ set |grep ZZZ # and there we go! our variable is set in the subshell/process.
You can open another terminal, and see that it is not set there, however.
http://ss64.com/bash/export.html
"Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.
It does not make it available everywhere in the system, only by processes created from that shell.
Here is an example you can try to prove the point.
("set" will list all the variables set in the terminal)
$ ZZZ=test
$ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
$ set |grep ZZZ # You will not see ZZZ=test
$ exit # Lets get out of the subshell and try export!
$ export ZZZ
$ bash
$ set |grep ZZZ # and there we go! our variable is set in the subshell/process.
You can open another terminal, and see that it is not set there, however.
http://ss64.com/bash/export.html
answered Jul 20 '12 at 5:20
JamezQ JamezQ
511
511
Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.
– Shen
Jul 20 '12 at 5:49
add a comment |
Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.
– Shen
Jul 20 '12 at 5:49
Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.
– Shen
Jul 20 '12 at 5:49
Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.
– Shen
Jul 20 '12 at 5:49
add a comment |
protected by Sergiy Kolodyazhnyy Feb 12 at 11:04
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?