source not working from within shell script

shell

Solution

Are you sourcing the script too: `source thescriptname`? Otherwise the script is running in a new shell and the `source bash_profile` command affects that new shell (which exits at the end of the script).

Problem

I have the following line in a shell script: ``` source bash_profile ``` It does not error, but it does not do anything that I can see either (It's not reloading my aliases like I expect) However, from the same folder that the shell script is in, if I just run the command from the shell, it works like I expect. I never change directories from within the script either. In fact, here is the script: ``` direction="to" destination="local" if [ -n $1 ] then direction=$1 fi if [ -n $2 ] then destination=$2 fi command=$direction$destination if [ $command = "fromlocal" -o $command = "togit" ] then cp /c/Program\ Files/Git/etc/bash_profile /d/automata/flgitscripts/bash_profile else cp /d/automata/flgitscripts/bash_profile /c/Program\ Files/Git/etc/bash_profile fi source /c/Program\ Files/Git/etc/bash_profile ``` I use the script to manage changes to and from the bash_profile and store them in a git repo. Why isn't the source command working from within the shell script?

Original source