As Nufal noted,. is an alias for source .
When searching for a file, all commands are executed in the context of the current bash session, which means that all environment variables exported by it will now be available to you.
If you run the script instead of the source, it is executed in a subshell, and the exported variables are not passed to your session. Essentially, this pretty much hits the .profile target.
As a demonstration, let's say you have a test.sh file:
#!/bin/bash # in test.sh print "exporting HELLO" export HELLO="my name is Paul"
If you execute it:
[ me@home ]$ bash test.sh exporting HELLO [ me@home ]$ echo $HELLO
Nothing prints because $HELLO not defined in your current session. However, if you use it:
[ me@home ]$ . test.sh exporting HELLO [ me@home ]$ echo $HELLO my name is Paul
Then $HELLO will be available in your current session.
Shawn chin
source share