The dot built-in reads a file and executes commands in it.
Syntax
-
. [-AL] file [argument…]
Description
The dot built-in reads the specified file, parses its contents as commands, and executes them in the current command execution environment.
If arguments are specified, positional parameters are temporarily set to them. The positional parameters will be restored when the dot built-in finishes. If no arguments are specified, the positional parameters are not changed.
If file does not contain any slashes, the shell searches
$PATH
for a readable (but not necessarily
executable) shell script file whose name is file in the same manner as
command search.
If no such file was found, the shell searches the current working directory
for a file unless in the POSIXly-correct mode.
To ensure that the file in the current working directory is used, start
file with ‘./’.
Options
-
-A
-
--no-alias
-
Disable alias substitution while parsing.
-
-L
-
--autoload
-
Search
$YASH_LOADPATH
instead of$PATH
, regardless of whether file contains slashes. The file value is not considered relative to the current working directory.
The dot built-in treats as operands any command line arguments after the first operand.
Operands
- file
-
The pathname of a file to be read.
- arguments…
-
Strings to which positional parameters are set while execution.
Exit status
The exit status of the dot built-in is that of the last command executed. The exit status is zero if the file contains no commands to execute and non-zero if a file was not found or could not be opened.
Notes
The dot built-in is a special built-in.
A non-interactive shell immediately exits with a non-zero exit status if the dot built-in fails to find or open a file to execute.
The POSIX standard defines no options for the dot built-in; the built-in accepts no options in the POSIXly-correct mode.
The POSIX standard does not define the arguments… operands. It is an error to specify the arguments… operands in the POSIXly-correct mode.