| Server IP : 217.160.0.244 / Your IP : 216.73.217.127 Web Server : Apache System : Linux infong-eu155 4.4.400-icpu-108 #2 SMP Wed Feb 11 11:51:01 UTC 2026 x86_64 User : u100174116 ( 6746176) PHP Version : 8.5.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/share/zsh/help/ |
Upload File : |
autoload [ {+|-}RTUXdkmrtWz ] [ -w ] [ name ... ]
See the section `Autoloading Functions' in zshmisc(1) for full
details. The fpath parameter will be searched to find the func-
tion definition when the function is first referenced.
If name consists of an absolute path, the function is defined to
load from the file given (searching as usual for dump files in
the given location). The name of the function is the basename
(non-directory part) of the file. It is normally an error if the
function is not found in the given location; however, if the op-
tion -d is given, searching for the function defaults to $fpath.
If a function is loaded by absolute path, any functions loaded
from it that are marked for autoload without an absolute path
have the load path of the parent function temporarily prepended
to $fpath.
If the option -r or -R is given, the function is searched for im-
mediately and the location is recorded internally for use when
the function is executed; a relative path is expanded using the
value of $PWD. This protects against a change to $fpath after
the call to autoload. With -r, if the function is not found, it
is silently left unresolved until execution; with -R, an error
message is printed and command processing aborted immediately the
search fails, i.e. at the autoload command rather than at func-
tion execution..
The flag -X may be used only inside a shell function. It causes
the calling function to be marked for autoloading and then imme-
diately 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 au-
toloading. If an argument is given, it is used as a directory
(i.e. it does not include the name of the function) in which the
function is to be found; this may be combined with the -d option
to allow the function search to default to $fpath if it is not in
the given location.
The flag +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 lat-
ter case the function remains undefined and marked for autoload-
ing. If ksh-style autoloading is enabled, the function created
will contain the contents of the file plus a call to the function
itself appended to it, thus giving normal ksh autoloading behav-
iour on the first call to the function. If the -m flag is also
given each name is treated as a pattern and all functions already
marked for autoload that match the pattern are loaded.
With the -t flag, turn on execution tracing; with -T, turn on ex-
ecution tracing only for the current function, turning it off on
entry to any called functions that do not also have tracing en-
abled.
With the -U flag, alias expansion is suppressed when the function
is loaded.
With the -w flag, the names are taken as names of files compiled
with the zcompile builtin, and all functions defined in them are
marked for autoloading.
The flags -z and -k mark the function to be autoloaded using the
zsh or ksh style, as if the option KSH_AUTOLOAD were unset or
were set, respectively. The flags override the setting of the
option at the time the function is loaded.
Note that the autoload command makes no attempt to ensure the
shell options set during the loading or execution of the file
have any particular value. For this, the emulate command can be
used:
emulate zsh -c 'autoload -Uz func'
arranges that when func is loaded the shell is in native zsh emu-
lation, and this emulation is also applied when func is run.
Some of the functions of autoload are also provided by functions
-u or functions -U, but autoload is a more comprehensive inter-
face.