I never understand what "export" does. For example, what's the difference between these two?
PYTHONPATH=/home/myaccount/ & export PYTHONPATHandPYTHONPATH=/home/myaccount/
One with export and the other without.
|
I never understand what "export" does. For example, what's the difference between these two?
One with export and the other without. |
||||
|
|
|
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). |
||||
|
|
|
"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)
You can open another terminal, and see that it is not set there, however. |
|||
|