Exporting a Path Variable inside a shell script [duplicate] Exporting a Path Variable inside a shell script [duplicate] shell shell

Exporting a Path Variable inside a shell script [duplicate]


Shell scripts run in a subshell (which you define int the first line as #!/bin/bash), any change in the environment is local to that subshell, so, the sourcing of bash_profile affects only the subshell.

To execute the commands in your current shell, use the source command to run the script in your current shell (http://ss64.com/bash/source.html)

e.g.instead of

$ ./myscript.sh

run:

$ source ./myscript.sh