Export PATH
I was just reading about the command "Export PATH" and wasn't quite sure why this had to be done? This has confused me in the past.
Thanks. |
Basically you only have to export your path if you change it. Otherwise, changes won't take effect until after a logout/login.
|
After you set a path it will be used by the current shell. If you don't export that path, any programs you run from the current shell will inherit the PATH that existed when the current shell was started. This applies to other variables as well. When you export PATH or export VARIABLE in general, that variable is available in the environment of the programs you run from the current shell. I agree it can be confusing at first, but after you work with the concept a little while it will seem natural and logical.
|
Not quite; any setting in the current shell (ie not exported) will be picked up by programs in the current shell level, but not by any sub-shells. What export does is 'export' (sic) those variables to all sub-shells/envs created from that shell ie unless you call a shell by
source x.sh OR . x.sh non-exported vars will not be avail to the new shell. http://www.ibm.com/developerworks/library/l-bash.html |
All times are GMT -5. The time now is 07:26 AM. |