0

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/

Community
  • 1
  • 1
bcf
  • 2,104
  • 1
  • 24
  • 43
  • 6
    `.bashrc` is implicitly sourced, not executed, when a non-login interactive shell starts. – chepner Mar 05 '17 at 16:21
  • You may find this helpful: http://unix.stackexchange.com/questions/3507/difference-between-environment-variables-and-exported-environment-variables-in-b – Sharad Mar 05 '17 at 17:18

0 Answers0