lang/bash/ SourcingScripts


source file.sh # also looks in path
. file.sh # the same in bash (in zsh . looks _only_ in the path, not the current directory)

to exit from a script use return, not exit, the latter will exit the shell running the script.

The use of sourcing scripts vs running them as executables is that they can affect the shell running them. The use of executable scripts is that they can't affect the shell running them.