Dot (Unix)

In a Unix shell, the full stop called the dot command (.) is a command that executes or opens a computer file. The filename is the dot command's first argument. One may specify parameters in a second argument. If no parameters are specified, the sourced file will receive the set of positional parameters available in the current context. If parameters are specified, the sourced file will receive only the specified parameters. In any case, parameter $0 will be the $0 of the current context.

The file does not have to be executable, but must be accessible from a directory defined in the PATH environment variable. The dot command is often used to define environment variables that are accessible within the current process. In contrast to file executed directly as an executable, there won't be a new process opened and the environment definitions defined within apply to the current process or the current shell.

The dot command is not to be confused with a dot file, which is a dot-prefixed hidden file or hidden directory. Nor is it to be confused with the ./scriptfile notation for running commands, which is simply a relative path pointing to the current directory (notated in Unix as a '.' character, and typically outside of the Path variable).

External links