Going through some old Bash files, I noticed this kind of thing
Here’s a good answer on Stack Overflow explaining why the source command is used:
Running the command
sourceon a script executes the script within the context of the current process. This means that environment variables set by the script remain available after it’s finished running. This is in contrast to running a script normally, in which case environment variables set within the newly-spawned process will be lost once the script exits. You can
sourceany runnable shell script. The end effect will be the same as if you had typed the commands in the script into your terminal.
For example, if the script changes directories, when it finishes running, your current working directory will have changed.
To see this, create a file
and a directory
Change the file’s permissions
Run the file normally
which shows the same directory.
Now try running the file with
which shows you are in