Reputation: 33
I am using git-bash on windows to execute the following lines. What i have seen is that the changes are not persistent or permanent once i close the existing session and open a new git-bash shell window or session. How can i make these changes to the PATH variable permanent on windows?
#!/bin/bash
#########Sample GitBash Shell Script on Windows############
echo "Append to PATH"
echo $PATH
PATH=$PATH:/c/temp
export PATH
echo $PATH
Upvotes: 1
Views: 833
Reputation: 1329232
If you are in a git bash session, and want your script to impact your current shell environment, you cannot execute the script (that would spawn a sub-shell)
You need to source your script:
cd /path/to/your/script
source yourScript.sh
Then echo $PATH
would display the updated value.
Upvotes: 1