LinuxCommandLibrary

source

Execute commands in the current shell environment

TLDR

Evaluate contents of a given file

$ source [path/to/file]
copy

Evaluate contents of a given file (alternatively replacing source with .)
$ . [path/to/file]
copy

SYNOPSIS

source filename [arguments]

DESCRIPTION

source reads and executes commands from a file in the current shell environment. Unlike running a script, source doesn't create a subshell, so variables and functions defined in the file remain available in the current shell.

CAVEATS

Shell built-in. File must be readable. Changes persist in current shell. Equivalent to '.' command.

SEE ALSO

.(1), bash(1), exec(1)

Copied to clipboard