source builtin

The builtin that runs a file's commands in the current shell instead of in a new one; the POSIX spelling is a single dot.

In more detail

Variables, functions and cd changes made by the file stay in your shell afterwards, which is how .bashrc and configuration files work. That is also its risk: a sourced file can change anything in your session. The file needs read permission only.

Examples

source settings.sh
. ./settings.sh

Related terms

Taught in

References