.

NAME

. - Execute shell file in current environment

SYNOPSIS

. file [argument ...]

DESCRIPTION

This command is a Korn-shell built-in command.

The period, or dot (.), runs a shell script in the current environment, and then returns. The shell typically runs a command file in a subshell, so that changes to the environment through commands such as cd, set, and trap are strictly local to the command file. The dot command enables you to circumvent this feature.

If there are slashes (/) in the file name, dot searches for the named file. If there are no slashes, dot uses the search PATH variable to find file. If using dot to execute a file under the current directory results in the shell not locating the shell file, it is likely that the search rules are not set up to search the current directory. You can solve this problem by using:

. ./file

. ./file indicates that the shell file you want to run is in the current directory, which is not required to be executable even if it is searched for on the PATH. If you specify more than one argument, dot sets positional parameters to the argument list before running it.

ENVIRONMENT VARIABLES

Environment variable Description
PATH Contains a list of directories that dot searches when attempting to find file.

DIAGNOSTICS

Possible exit-status values are:

Value Description
1 Path search failed or file is unreadable.
2 Failure because of an invalid command-line option.

Otherwise, the exit status is that of the last command carried out from the script.