The source
command is a shell builtin that reads and executes commands from a file in the current shell environment.
The source
command is often used to execute script files or to load configuration files that define variables, functions, or aliases.
To use the source
command, you can specify the name of the file that you want to execute as an argument. For example:
source script.sh
This will execute the commands in the script.sh
file in the current shell environment.
The source
command is similar to the .
(dot) operator, which also reads and executes commands from a file in the current shell environment. For example:
. script.sh
The source
command is available in most Unix and Linux shells, including bash
, zsh
, and csh
.
It is important to note that the source
command does not create a new shell process, and any changes made to the shell environment (such as setting variables or defining functions) will persist after the command has completed.
For more information about the source
command and how to use it in your specific Unix or Linux shell, you can consult the documentation for your shell.