According to this answer, simply placing the export
command in a bash
script does not affect an environment variable unless the source
command is used. However, after installing Anaconda for Python, I noticed the installer added the following line in the shell script .bashrc
:
export PATH="/host/anaconda2/bin:$PATH"
Running printenv
reveals this statement did indeed seem to have the desired effect. My questions are, how does the export statement in the script effect the environment variables without the source
command, and why is the source
command usually needed to have this effect? I.e., why doesn't the script just perform the export
statement without the source
command/