-1

I'm using Mac OS 10.8. I ran the /sw/fink/bin/init.sh script using the bash command which was supposed to make the fink/bin folder part of the $PATH variable for the current session.

The fink command didn't work, so I ran the script again with the . command which I was told was equivalent to the source command; I was able to call fink now without an absolute path.

Why did . work and not bash? Is it because the sh and bash commands run with their own temporary $PATH variable?

3
  • 1
    Mac OS 10.8 is a derivative of Ubuntu since when?
    – Rinzwind
    Feb 7, 2013 at 7:30
  • This is also relevant to Ubuntu users, don't be a d**k
    – Anthony
    Feb 7, 2013 at 10:58
  • No it is not otherwise you would have used Ubuntu in the topic. Different OS's have different ways of doing things and all we know is about how Ubuntu works. So -all- answers you get will be based on Ubuntu and it can be very very dangerous (well probably not in this case ;) ) to assume methods that work on Ubuntu work on other systems that are not Ubuntu related. And if even MINT questions get hammered down why would MAC OS stay open? If anything this should have been asked on unix.stackexchange.com and not here. And please do not blame me when you are doing it wrongly ;)
    – Rinzwind
    Feb 7, 2013 at 13:46

1 Answer 1

3

bash somescript will start a new bash shell, evaluate your script and then exit. The script will see a copy of your current environment, but any changes will be discarded when the script ends.

. somescript or source somescript will evaluate the script in your current context, so changes to existing environment variables, or the setting of new ones, will be retained.

Not the answer you're looking for? Browse other questions tagged .