What is the difference between

. script.sh


source script.sh



1 Answer 1


The above executes the script. When the script is done, any changes that it made to the environment are discarded.

. script

The above sources the script. It is as if the commands had been typed in directly. Any environment changes are kept.

source script

This also sources the script. The source command is not required by POSIX and therefore is less portable than the shorter ..

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