z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Autoloading functions

z/OS UNIX System Services User's Guide
SA23-2279-00

Autoloading improves the performance of shell initialization by delaying function definition processing until the first use. Functions that are not used by a particular user are never read by the shell, thus avoiding the processing of unused functions. The FPATH variable allows flexibility in accessing directories with systemwide, group, or personal function definitions.

FPATH is defined with the same format as the PATH variable. FPATH is a list of directories separated by colons. These directories contain only function definitions and should not contain the current working directory.

To use autoloading, place frequently used and shared functions in a directory pointed to by the FPATH variable and specify the function name on an autoload or typeset –f command in the user's ENV setup script.

The autoload command identifies functions that are not yet defined. The first time that an autoload function is called within the shell, the shell searches FPATH directories for a file with the same name as the function definition. If a matching file with the same name as the function is found, it is processed and stored in the shell's memory for subsequent execution. The matching file contains the function definition for the autoload function. Other function definitions may be found in this matching file, and if so, they will be defined to the shell when the file is processed. For information about how to set up the FPATH search path, see Customizing the FPATH search path: The FPATH variable.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014