autoload

autoload [ {+|-}UXmt ] [ -wkz ] [ name ... ]

Equivalent to functions -u, with the exception of -X /+X, -w, -k and -z.

-X

Can be used only inside a shell function, and may not be followed by a name. It causes the calling function to be marked for autoloading and then immediately loaded and executed, with the current array of positional parameters as arguments. This replaces the previous definition of the function. If no function definition is found, an error is printed and the function remains undefined and marked for autoloading.

+X

Attempts to load each name as an autoloaded function, but does not execute it. The exit status is zero (success) if the function was not previously defined and a definition for it was found. This does not replace any existing definition of the function. The exit status is nonzero (failure) if the function was already defined or when no definition was found. In the latter case the function remains undefined and marked for autoloading.

It can also be combined with either -k or -z to make the function be loaded using ksh-style or zsh-style autoloading, respectively. If neither is given, the current setting of the KSH_AUTOLOAD options determines how the function is loaded. With ksh-style autoloading, the contents of the file will not be executed immediately. Instead, the function created will contain the contents of the file plus a call to the function itself appended to it, thus given normal ksh autoloading behaviour on the first call to the function.

Note: The Symbian platform does not support the use of -w option.