What does the
source command do?
Source evaluates any file written after, the file if containing any commands to run, it will execute them in the order they were written in the file. for example if our file had:
echo 'This is the first one' echo 'second' echo 'and third'
source <ourFilename> or
. <ourFilename> (because
. is the shorthand for the
source command) we will see:
This is the first one second and third
of course, it does not only work with the
echo command, but with any kind.
Something to keep in mind is that
. version is not the same as
./, dot space and file name is the
source command running the commands in the written file, but with
./ dot is simply a mark of origin, stating that the origin from which the path will be read is the current directory. Like:
./someDir/somefile means that someDir/ is in the same location that we presently are.