builtin
Bash . — read a file in the current shell
The dot built-in reads a trusted shell file in the current execution environment. In Bash it is equivalent to source; portability of optional arguments and path lookup must be checked against the target shell. State changes can persist. Example prerequisite: in a fresh lab directory, create trusted-lab-settings.sh containing a single line: printf '%s\n' 'Trusted lab file'.
Formal Syntax & Structure
bash syntaxbash
. filename [arguments]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| filename | path | Trusted readable shell file. |
| arguments | string list | Optional arguments in Bash. |
Return Value
exit status
Status of last command executed, or 0 for an empty file; nonzero if inaccessible.
Working Example
Example Snippetbash
. ./trusted-lab-settings.sh