Let’s understand each of these in the context of the sample test.sh file.
Using “./“
The changes made by script gets discarded as soon as scripts end because this runs script by forking a separate process. Example:
./test.sh
Using “.“
The changes made by the script persist till the terminal remains alive because the script gets executed in the same bash process. Example:
. test.sh
Using “source“
source are “.” are synonyms and the same thing. “.” is the inclusion of POSIX standard. Example:
source test.sh