. (dot), source

execute KornShell script in current environment 

KornShell Built-in


SYNOPSIS

. file [argument ...]

source file [argument ...]


DESCRIPTION

. (dot) executes a KornShell script in the current environment and then returns. Normally the shell executes a command file in a subshell so that changes to the environment by commands like cd, set, and trap are local to the command file. The . (dot) command circumvents this feature.

If there are slashes in the file name, . (dot) looks for the named file. If there are no slashes, . (dot) uses the search PATH variable to find file. This may surprise some people when they use dot to execute a file under the current directory, but their search rules are not set up to look at the current directory. As a result, the shell doesn't find the file. If you have this problem, you can use

 . ./file

This indicates that the shell file you want to run is in the current directory. Also, the file need not be executable, even if it is looked for on the PATH. If you specify more than one argument, . (dot) sets the positional parameters to the argument list before execution.

The source utility is identical to the . (dot) utility.


ENVIRONMENT VARIABLES

PATH 

contains a list of directories that . (dot) searches when attempting to find file.


DIAGNOSTICS

Possible exit status values are:

1 

Path search failed or file is unreadable.

2 

Failure because of an invalid command line option.

Otherwise, the exit status is the exit status of the last command executed from the script.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

On Windows systems, . (dot) adds .ksh as a suffix to file if there is no . in the file.

The ability to handle arguments is an extension to the POSIX.2 and XPG standards.


NOTE

This is a special built-in command of the MKS KornShell.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
cd, set, sh, trap


PTC MKS Toolkit 10.4 Documentation Build 39.