The POSIX shell built-in . (dot) executes the specified shell script in the current shell.
If you define new shell variables in the shell script or modify the values of existing shell variables, these variables take effect in the current shell environment.
If you set or unset shell options in the shell script with the shell built-in set, these options are set/unset in the current shell.
When you call the shell script, you can pass keyword parameters to it, but you cannot redefine the positional parameters. However, within the script you can access the positional parameters of the current shell.
If you use set to redefine the positional parameters within the script, the new values apply in the current shell.
Syntax
. file |
Name of the shell script to be executed in the current shell. The shell searches for file in all directories whose path names have been assigned to the PATH variable. Read permission is required for the specified file. |
Variable
PATH Search path of the shell |
Locale
The following environment variables affect the execution of .: LANG Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. |
Example
When you create or modify your $HOME/.profile file, the commands and assignmentscontained in it are normally not executed until you next log in (open a login shell). The dot command enables you to make these changes effective in the current shell itself, provided that the current directory is assigned to the PATH variable:
|
See also
sh |