Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Modernizing Documentation format?



On 8/22/2025 20:40, dana wrote:
On Fri 22 Aug 2025, at 11:54, Clinton Bunch wrote:
Man is good for reference on small single use programs.  It struggles
with large programs or languages.
that's how i feel also. if it's a language, compiler, etc, i prefer
html. and ours does the job but it could be a lot better

On Fri 22 Aug 2025, at 17:41, Clinton Bunch wrote:
None of this discussion of programming languages is really pertinent to
a discussion of a new documentation system for zsh to replace YODL,
yes, 99% of documentation changes are going to be in the documentation
language, so how anyone feels about the syntax or 'culture' of whatever
it's implemented in doesn't seem that important

the main thing is how annoying of a dependency it is. python is
pre-installed on almost every system anyone would be developing zsh on,
or it's trivial to get if somehow it's not, so i think it's fine

On Fri 22 Aug 2025, at 17:41, Clinton Bunch wrote:
I haven't seen an example of mandoc that doesn't look like a man page
presented in a web browser.
afaik that's deliberate. mandoc is designed exclusively for producing
traditional-style man pages and its feature set and rendering output
reflect that

even if that wasn't the case i think maintaining a large body of
documentation in any roff-derived language is a nightmare. i can't think
of any non-legacy projects that do it. the syntax is disgusting and it's
full of weird rules that even people who are familiar with it always
forget. imo it would be a downgrade from yodl

idk about texinfo. i have managed to avoid it my entire life. it doesn't
seem popular outside of gnu projects in any case

the obvious competitor to rst is adoc, but the dependency on ruby is
probably more objectionable than the python one, and i don't think the
syntax or functionality is any better than rst's

some projects still use docbook but many that previously did (linux,
gnome, bind, nixos, rsync) have switched away

straight markdown is almost ideal to me syntax-wise but we'd need tonnes
of boiler-plate to get the functionality we want

the myst extension for sphinx semi addresses that by taking rst's
functionality and making it a superset of commonmark. but it seems like
it's still not used much outside of the python eco-system. maybe that
would make people nervous

dana

I am sorry it has taken nearly a year to get back to this. (Squirrel :))  But here's a sample of zshbuiltins translated and the man and in-tree html output (purposely kept simple for quick terminal or local use.  I plan to do a more functional and prettier one for the website)
Shell Builtin Commands
================================================================================
.. only:: man

Shell Builtin Commands
--------------------------------------------------------------------------------

.. index:: single: builtin commands; Command

.. index:: single: commands, builtin; Command

Some shell builtin commands take options as described in individual
entries; these are often referred to in the list below as ``flags`` to
avoid confusion with shell options, which may also have an effect on the
behaviour of builtin commands.  In this introductory section,
``option`` always has the meaning of an option to a command that should
be familiar to most command line users.

Typically, options are single letters preceded by a hyphen (``-``).
Options that take an argument accept it either immediately following the
option letter or after white space, for example ``print -C3 {1..9}`` or
``print -C 3 {1..9}`` are equivalent.  Arguments to options are not the
same as arguments to the command; the documentation indicates which is
which.  Options that do not take an argument may be combined in a single
word, for example ``print -rca -- *`` and ``print -r -c -a -- *`` are
equivalent.

Some shell builtin commands also take options that begin with ``+``
instead of ``-``.  The list below makes clear which commands these
are.

Options (together with their individual arguments, if any) must appear
in a group before any non-option arguments; once the first non-option
argument has been found, option processing is terminated.

All builtin commands other than ``echo`` and precommand modifiers,
even those that have no options, can be given the argument ``--``
to terminate option processing.  This indicates that the following words
are non-option arguments, but is otherwise ignored.  This is useful in
cases where arguments to the command may begin with ``-``.  For
historical reasons, most builtin commands (including ``echo``) also
recognize a single ``-`` in a separate word for this purpose; note
that this is less standard and use of ``--`` is recommended.

``-`` :var:`simple command`
    
    See :ref:`Precommand Modifiers`.
    

.. index:: single: .; Function

``.`` :var:`file` [ :var:`arg` ... ]
    
    Read commands from :var:`file` and execute them in the current shell
    environment.
    
    If :var:`file` does not contain a slash, or if ``PATH_DIRS`` is set,
    the shell looks in the components of ``$path`` to find the directory
    containing :var:`file`.  Files in the current directory are not read
    unless ``.`` appears somewhere in ``$path``.  If a file named
    :var:`file`\ ``.zwc`` is found, is newer than :var:`file`, and is the
    compiled form (created with the ``zcompile`` builtin) of :var:`file`,
    then commands are read from that file instead of :var:`file`.
    
    If any arguments :var:`arg` are given,
    they become the positional parameters; the old positional
    parameters are restored when the :var:`file` is done executing.
    However, if no arguments are given,
    the positional parameters remain those of the calling context,
    and no restoring is done.
    
    If :var:`file` was not found the return status is 127; if :var:`file` was found
    but contained a syntax error the return status is 126; else the return
    status is the exit status of the last command executed.
    

.. index:: single: :; Function

.. index:: single: expanding parameters; Command

.. index:: single: parameters, expanding; Command

.. index:: single: doing nothing; Command

``:`` [ :var:`arg` ... ]
    
    This command does nothing, although normal argument expansions is performed
    which may have effects on shell parameters.  A zero exit status is returned.
    

.. index:: single: alias; Function

.. index:: single: aliases, defining; Command

.. index:: single: aliases, listing; Command

``alias`` [ {``+|-}gmrsL`` ] [ :var:`name`\[``=``:var:`value`] ... ]
    
    For each :var:`name` with a corresponding :var:`value`, define an alias
    with that value.  A trailing space in :var:`value` causes the next word
    to be checked for alias expansion.  If the ``-g`` flag is present,
    define a global alias; global aliases are expanded even if they do not
    occur in command position:
    
    .. parsed-literal::
       :class: example
    

        % perldoc --help 2>&1 | grep 'built-in functions'
            -f   Search Perl built-in functions
        % alias -g HG='--help 2>&1 | grep'
        % perldoc HG 'built-in functions'
            -f   Search Perl built-in functions
    
    
    If the ``-s`` flag is present, define a suffix alias: if the command
    word on a command line is in the form :var:`text`\ ``.``:var:`name`, where
    :var:`text` is any non-empty string, it is replaced by the text
    :var:`value` :var:`text`\ ``.``:var:`name`.  Note that :var:`name` is treated as
    a literal string, not a pattern.  A trailing space in :var:`value` is not
    special in this case.  For example,
    
    .. parsed-literal::
       :class: example
    

        alias -s ps='gv --'
    
    
    will cause the command ``*.ps`` to be expanded to ``gv -- *.ps``.  As
    alias expansion is carried out earlier than globbing, the ``*.ps`` will
    then be expanded.  Suffix aliases constitute a different name space from
    other aliases (so in the above example it is still possible
    to create an alias for the command ``ps``) and the two sets are never
    listed together.
    
    For each :var:`name` with no :var:`value`,
    print the value of :var:`name`, if any.  With no arguments, print all
    currently defined aliases other than suffix aliases.  If the ``-m`` flag
    is given the arguments are taken as patterns (they should be quoted to
    preserve them from being interpreted as glob patterns), and the aliases
    matching these patterns are printed.  When printing aliases and one of
    the ``-g``, ``-r`` or ``-s`` flags is present, restrict the printing to
    global, regular or suffix aliases, respectively; a regular alias is one
    which is neither a global nor a suffix alias.   Using ``+``
    instead of ``-``, or ending the option list with a single
    ``+``, prevents the values of the aliases from being printed.
    
    If the ``-L`` flag is present, then print each
    alias in a manner suitable for putting in a startup script.  The exit
    status is nonzero if a :var:`name` (with no :var:`value`) is given for
    which no alias has been defined.
    
    For more on aliases, including common problems,
    see :ref:`Aliasing`.
    

.. index:: single: autoload; Function

.. index:: single: functions, autoloading; Command

.. index:: single: autoloading functions; Command

``autoload`` [ {``+|-}RTUXdkmrtWz`` ] [ ``-w`` ] [ :var:`name` ... ]
    
    .. index:: single: fpath, searching; Variable
    
    
    See :ref:`Autoloading Functions`
    for full details.  The ``fpath`` parameter
    will be searched to find the function definition when the function is
    first referenced.
    
    If :var:`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 option ``-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
    immediately 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 function execution..
    
    The flag ``-X`` may be used only inside a shell function.  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.  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 :var:`name` as an autoloaded function,
    but does :emphasis:`not` execute it.  The exit status is zero (success) if the
    function was not previously defined :emphasis:`and` a definition for it was found.
    This does :emphasis:`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.  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 behaviour on the first call to the function.
    If the ``-m`` flag is also given each :var:`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
    execution tracing only for the current function, turning it off on entry
    to any called functions that do not also have tracing enabled.
    
    With the ``-U`` flag, alias expansion is suppressed when the function is
    loaded.
    
    With the ``-w`` flag, the :var:`name`\s 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:
    
    .. parsed-literal::
       :class: example
    

        emulate zsh -c 'autoload -Uz :var:`func`'
    
    
    arranges that when :var:`func` is loaded the shell is in native ``zsh``
    emulation, and this emulation is also applied when :var:`func` is run.
    
    Some of the functions of ``autoload`` are also provided by ``functions
    -u ``or`` functions -U``, but`` autoload`` is a more comprehensive
    interface.
    

.. index:: single: bg; Function

.. index:: single: jobs, backgrounding; Command

``bg`` [ :var:`job` ... ]

:var:`job` ... ``&``
    
    Put each specified :var:`job` in the background,
    or the current job if none is specified.
    

``bindkey``
    
    See :ref:`Zle Builtins`.
    

.. index:: single: break; Function

.. index:: single: exiting loops; Command

.. index:: single: loops, exiting; Command

``break`` [ :var:`n` ]
    
    Exit from an enclosing ``for``, ``while``,
    ``until``, ``select`` or ``repeat`` loop. If an arithmetic expression :var:`n`
    is specified, then break :var:`n` levels instead of just one.
    

.. index:: single: builtin; Function

``builtin`` :var:`name` [ :var:`args` ... ]
    
    Executes the builtin :var:`name`, with the given :var:`args`.
    

.. index:: single: bye; Function

``bye``
    
    Same as ``exit``.
    

``cap``
    
    See :ref:`The zsh/cap Module`.
    

.. index:: single: cd; Function

.. index:: single: directories, changing; Command

``cd`` [ ``-qsLP`` ] [ :var:`arg` ]

``cd`` [ ``-qsLP`` ] :var:`old` :var:`new`

``cd`` [ ``-qsLP`` ] {``+|-``}:var:`n`
    
    Change the current directory.  In the first form, change the
    current directory to :var:`arg`, or to the value of ``$HOME`` if
    :var:`arg` is not specified.  If :var:`arg` is ``-``, change to the
    previous directory.
    
    Otherwise, if :var:`arg` begins with a slash, attempt to change to the
    directory given by :var:`arg`.
    
    If :var:`arg` does not begin with a slash, the behaviour depends on whether
    the current directory ``.`` occurs in the list of directories contained
    in the shell parameter ``cdpath``.  If it does not, first attempt to change
    to the directory :var:`arg` under the current directory, and if that fails
    but ``cdpath`` is set and contains at least one element attempt to change
    to the directory :var:`arg` under each component of ``cdpath`` in turn until
    successful.  If ``.`` occurs in ``cdpath``, then ``cdpath`` is searched
    strictly in order so that ``.`` is only tried at the appropriate point.
    
    The order of testing ``cdpath`` is modified if the option ``POSIX_CD``
    is set, as described in the documentation for the option.
    
    If no directory is found, the option ``CDABLE_VARS`` is set, and a
    parameter named :var:`arg` exists whose value begins with a slash, treat its
    value as the directory.  In that case, the parameter is added to the named
    directory hash table.
    
    The second form of ``cd`` substitutes the string :var:`new`
    for the string :var:`old` in the name of the current directory,
    and tries to change to this new directory.
    
    The third form of ``cd`` extracts an entry from the directory
    stack, and changes to that directory.  An argument of the form
    ``+``:var:`n` identifies a stack entry by counting from the left
    of the list shown by the ``dirs`` command, starting with zero.
    An argument of the form ``-``:var:`n` counts from the right.
    If the ``PUSHD_MINUS`` option is set, the meanings of ``+``
    and ``-`` in this context are swapped.
    If the ``POSIX_CD`` option is set, this form of ``cd`` is not recognised
    and will be interpreted as the first form.
    
    If the ``-q`` (quiet) option is specified, the hook function ``chpwd``
    and the functions in the array ``chpwd_functions`` are not called.
    This is useful for calls to ``cd`` that do not change the environment
    seen by an interactive user.
    
    If the ``-s`` option is specified, ``cd`` refuses to change the current
    directory if the given pathname contains symlinks.  If the ``-P`` option
    is given or the ``CHASE_LINKS`` option is set, symbolic links are resolved
    to their true values.  If the ``-L`` option is given symbolic links are
    retained in the directory (and not resolved) regardless of the state of
    the ``CHASE_LINKS`` option.
    

.. index:: single: chdir; Function

``chdir``
    
    Same as ``cd``.
    

``clone``
    
    See :ref:`The zsh/clone Module`.
    

.. index:: single: command; Function

``command`` [ ``-pvV`` ] :var:`simple command`
    
    The simple command argument is taken as an external command instead of
    a function or builtin and is executed. If the ``POSIX_BUILTINS`` option
    is set, builtins will also be executed but certain special properties
    of them are suppressed. The ``-p`` flag causes a default path to be
    searched instead of that in ``$path``. With the ``-v`` flag, ``command``
    is similar to ``whence`` and with ``-V``, it is equivalent to ``whence
    -v``.
    
    See also :ref:`Precommand Modifiers`.
    

``comparguments``
    
    See :ref:`The zsh/computil Module`.
    

``compcall``
    
    See :ref:`The zsh/compctl Module`.
    

``compctl``
    
    See :ref:`The zsh/compctl Module`.
    

``compdescribe``
    
    See :ref:`The zsh/computil Module`.
    

``compfiles``
    
    See :ref:`The zsh/computil Module`.
    

``compgroups``
    
    See :ref:`The zsh/computil Module`.
    

``compquote``
    
    See :ref:`The zsh/computil Module`.
    

``comptags``
    
    See :ref:`The zsh/computil Module`.
    

``comptry``
    
    See :ref:`The zsh/computil Module`.
    

``compvalues``
    
    See :ref:`The zsh/computil Module`.
    

.. index:: single: continue; Function

.. index:: single: loops, continuing; Command

.. index:: single: continuing loops; Command

``continue`` [ :var:`n` ]
    
    Resume the next iteration of the enclosing
    ``for``, ``while``, ``until``, ``select`` or
    ``repeat`` loop. If an arithmetic expression :var:`n` is specified, break out of
    :var:`n`-1 loops and resume at the :var:`n`\th enclosing loop.
    

.. index:: single: declare; Function

``declare``
    
    Same as ``typeset``.
    

.. index:: single: dirs; Function

.. index:: single: directory stack, printing; Command

``dirs`` [ ``-c`` ] [ :var:`arg` ... ]

``dirs`` [ ``-lpv`` ]
    
    With no arguments, print the contents of the directory stack.
    Directories are added to this stack with the ``pushd`` command,
    and removed with the ``cd`` or ``popd`` commands.
    If arguments are specified, load them onto the directory stack,
    replacing anything that was there, and push the current directory
    onto the stack.
    
    
    ``-c``
        
        clear the directory stack.
        
    
    ``-l``
        
        print directory names in full instead of using ``~`` expressions
        (see :ref:`Filename Expansion`).
        
    
    ``-p``
        
        print directory entries one per line.
        
    
    ``-v``
        
        number the directories in the stack when printing.
        
    
    
    
    

.. index:: single: disable; Function

.. index:: single: disabling commands; Command

.. index:: single: commands, disabling; Command

``disable`` [ ``-afmprs`` ] :var:`name` ...
    
    Temporarily disable the :var:`name`\d hash table elements or patterns.  The default
    is to disable builtin commands.  This allows you to use an external
    command with the same name as a builtin command.  The ``-a`` option
    causes ``disable`` to act on regular or global aliases.  The ``-s``
    option causes ``disable`` to act on suffix aliases.  The ``-f`` option causes
    ``disable`` to act on shell functions.  The ``-r`` options causes
    ``disable`` to act on reserved words.  Without arguments all disabled
    hash table elements from the corresponding hash table are printed.
    With the ``-m`` flag the arguments are taken as patterns (which should be
    quoted to prevent them from undergoing filename expansion), and all hash
    table elements from the corresponding hash table matching these patterns
    are disabled.  Disabled objects can be enabled with the ``enable``
    command.
    
    With the option ``-p``, :var:`name` ... refer to elements of the
    shell's pattern syntax as described in :ref:`Filename Generation`.
    Certain elements can be disabled separately, as given below.
    
    Note that patterns
    not allowed by the current settings for the options ``EXTENDED_GLOB``,
    ``KSH_GLOB`` and ``SH_GLOB`` are never enabled, regardless of the
    setting here.  For example, if ``EXTENDED_GLOB`` is not active,
    the pattern ``^`` is ineffective even if ``disable -p "^"`` has
    not been issued.  The list below indicates any option settings
    that restrict the use of the pattern.  It should be noted that
    setting ``SH_GLOB`` has a wider effect than merely disabling patterns
    as certain expressions, in particular those involving parentheses,
    are parsed differently.
    
    The following patterns may be disabled; all
    the strings need quoting on the command line to prevent them from
    being interpreted immediately as patterns and the patterns are
    shown below in single quotes as a reminder.
    
    
    ``'?'``
        
        The pattern character ``?`` wherever it occurs, including when preceding
        a parenthesis with ``KSH_GLOB``.
        
    
    ``'*'``
        
        The pattern character ``*`` wherever it occurs, including recursive
        globbing and when preceding a parenthesis with ``KSH_GLOB``.
        
    
    ``'['``
        
        Character classes.
        
    
    ``'<'`` (``NO_SH_GLOB``)
        
        Numeric ranges.
        
    
    ``'|'`` (``NO_SH_GLOB``)
        
        Alternation in grouped patterns, case statements, or KSH_GLOB
        parenthesised expressions.
        
    
    ``'('`` (``NO_SH_GLOB``)
        
        Grouping using single parentheses.  Disabling this does not disable the
        use of parentheses for ``KSH_GLOB`` where they are introduced by a
        special character, nor for glob qualifiers (use ``setopt
        NO_BARE_GLOB_QUAL`` to disable glob qualifiers that use parentheses
        only).
        
    
    ``'~'`` (``EXTENDED_GLOB``)
        
        Exclusion in the form :var:`A`\ ``~``:var:`B`.
        
    
    ``'^'`` (``EXTENDED_GLOB``)
        
        Exclusion in the form :var:`A`\ ``^``:var:`B`.
        
    
    ``'#'`` (``EXTENDED_GLOB``)
        
        The pattern character ``#`` wherever it occurs, both for
        repetition of a previous pattern and for indicating globbing flags.
        
    
    ``'?('`` (``KSH_GLOB``)
        
        The grouping form ``?(``:var:`...`\ ``)``.  Note this is also
        disabled if ``'?'`` is disabled.
        
    
    ``'*('`` (``KSH_GLOB``)
        
        The grouping form ``*(``:var:`...`\ ``)``.  Note this is also
        disabled if ``'*'`` is disabled.
        
    
    ``'+('`` (``KSH_GLOB``)
        
        The grouping form ``+(``:var:`...`\ ``)``.
        
    
    ``'!('`` (``KSH_GLOB``)
        
        The grouping form ``!(``:var:`...`\ ``)``.
        
    
    ``'@('`` (``KSH_GLOB``)
        
        The grouping form ``@(``:var:`...`\ ``)``.
        
    
    
    

.. index:: single: disown; Function

.. index:: single: jobs, disowning; Command

``disown`` [ ``-a`` | :var:`job` ... ]

:var:`job` ... ``&|``

:var:`job` ... ``&!``
    
    Remove the specified :var:`job`\s from the job table; the shell will
    no longer report their status, and will not complain if you
    try to exit an interactive shell with them running or stopped.
    If no :var:`job` is specified, disown the current job.
    With ``-a``, disown all jobs.
    
    If the :var:`job`\s are currently stopped and the ``AUTO_CONTINUE`` option
    is not set, a warning is printed containing information about how to
    make them running after they have been disowned.  If one of the latter
    two forms is used, the :var:`job`\s will automatically be made running,
    independent of the setting of the ``AUTO_CONTINUE`` option.
    

.. index:: single: echo; Function

``echo`` [ ``-neE`` ] [ :var:`arg` ... ]
    
    Write each :var:`arg` on the standard output, with a space separating
    each one.
    If the ``-n`` flag is not present, print a newline at the end.
    ``echo`` recognizes the following escape sequences:
    
    
    ``\a``
        bell character
    
    ``\b``
        backspace
    
    ``\c``
        suppress subsequent characters and final newline
    
    ``\e``
        escape
    
    ``\f``
        form feed
    
    ``\n``
        linefeed (newline)
    
    ``\r``
        carriage return
    
    ``\t``
        horizontal tab
    
    ``\v``
        vertical tab
    
    ``\\``
        backslash
    
    ``\0``:var:`NNN`
        character code in octal
    
    ``\x``:var:`NN`
        character code in hexadecimal
    
    ``\u``:var:`NNNN`
        unicode character code in hexadecimal
    
    ``\U``:var:`NNNNNNNN`
        unicode character code in hexadecimal
    
    
    
    .. index:: single: BSD_ECHO, use of; Program
    
    
    The ``-E`` flag, or the ``BSD_ECHO`` option, can be used to disable
    these escape sequences.  In the latter case, ``-e`` flag can be used to
    enable them.
    
    Note that for standards compliance a double dash does not terminate
    option processing; instead, it is printed directly.  However, a
    single dash does terminate option processing, so the first dash,
    possibly following options, is not printed, but everything following it
    is printed as an argument.  The single dash behaviour is different
    from other shells.  For a more portable way of printing text, see
    ``printf``, and for a more controllable way of printing text within zsh,
    see ``print``.
    

``echotc``
    
    See :ref:`The zsh/termcap Module`.
    

``echoti``
    
    See :ref:`The zsh/terminfo Module`.
    

.. index:: single: emulate; Function

.. index:: single: compatibility, sh; Command

.. index:: single: compatibility, ksh; Command

.. index:: single: compatibility, csh; Command

.. index:: single: sh, compatibility; Command

.. index:: single: ksh, compatibility; Command

.. index:: single: csh, compatibility; Command

``emulate`` [ ``-lLR`` ] [ {``zsh|sh|ksh|csh``} [ :var:`flags` ... ] ]
    
    Without any argument print current emulation mode.
    
    With single argument set up zsh options to emulate the specified shell
    as much as possible.
    :strong:`csh` will never be fully emulated.
    If the argument is not one of the shells listed above, ``zsh``
    will be used as a default; more precisely, the tests performed on the
    argument are the same as those used to determine the emulation at startup
    based on the shell name, see :ref:`Compatibility`.
    In addition to setting shell options, the command also restores
    the pristine state of pattern enables, as if all patterns had been
    enabled using ``enable -p``.
    
    If the ``emulate`` command occurs inside a function that has been
    marked for execution tracing with ``functions -t`` then the ``xtrace``
    option will be turned on regardless of emulation mode or other options.
    Note that code executed inside the function by the ``.``, ``source``, or
    ``eval`` commands is not considered to be running directly from the
    function, hence does not provoke this behaviour.
    
    If the ``-R`` switch is given, all settable options
    are reset to their default value corresponding to the specified emulation
    mode, except for certain options describing the interactive
    environment; otherwise, only those options likely to cause portability
    problems in scripts and functions are altered.  If the ``-L`` switch is given,
    the options ``LOCAL_OPTIONS``, ``LOCAL_PATTERNS`` and ``LOCAL_TRAPS``
    will be set as
    well, causing the effects of the ``emulate`` command and any ``setopt``,
    ``disable -p`` or ``enable -p``, and ``trap`` commands to be local to
    the immediately surrounding shell
    function, if any; normally these options are turned off in all emulation
    modes except ``ksh``. The ``-L`` switch is mutually exclusive with the
    use of ``-c`` in :var:`flags`.
    
    If there is a single argument and the ``-l`` switch is given, the
    options that would be set or unset (the latter indicated with the prefix
    ``no``) are listed.  ``-l`` can be combined with ``-L`` or ``-R`` and
    the list will be modified in the appropriate way.  Note the list does
    not depend on the current setting of options, i.e. it includes all
    options that may in principle change, not just those that would actually
    change.
    
    The :var:`flags` may be any of the invocation-time flags described in
    :ref:`Invocation`,
    except that ``-o EMACS`` and ``-o VI`` may not be used.
    
    If ``-c`` :var:`arg` appears in :var:`flags`, :var:`arg` is evaluated while the
    requested emulation is temporarily in effect.  In this case the emulation
    mode and all options are restored to their previous values before
    ``emulate`` returns.  The ``-R`` switch may precede the name of the shell
    to emulate; note this has a meaning distinct from including ``-R`` in
    :var:`flags`.
    
    Use of ``-c`` enables \`sticky' emulation mode for functions defined
    within the evaluated expression:  the emulation mode is associated
    thereafter with the function so that whenever the function is executed
    the emulation (respecting the ``-R`` switch, if present) and all
    options are set (and pattern disables cleared)
    before entry to the function, and the state is restored after exit.
    If the function is called when the sticky emulation is already in
    effect, either within an ``emulate`` :var:`shell` ``-c`` expression or
    within another function with the same sticky emulation, entry and exit
    from the function do not cause options to be altered (except due to
    standard processing such as the ``LOCAL_OPTIONS`` option).  This also
    applies to functions marked for autoload within the sticky emulation;
    the appropriate set of options will be applied at the point the
    function is loaded as well as when it is run.
    
    For example:
    
    .. parsed-literal::
       :class: example
    

        emulate sh -c 'fni() { setopt cshnullglob; }
        fno() { fni; }'
        fno
    
    
    The two functions ``fni`` and ``fno`` are defined with sticky ``sh``
    emulation.  ``fno`` is then executed, causing options associated
    with emulations to be set to their values in ``sh``.  ``fno`` then
    calls ``fni``; because ``fni`` is also marked for sticky ``sh``
    emulation, no option changes take place on entry to or exit from it.
    Hence the option ``cshnullglob``, turned off by ``sh`` emulation, will
    be turned on within ``fni`` and remain on return to ``fno``.  On exit
    from ``fno``, the emulation mode and all options will be restored to the
    state they were in before entry to the temporary emulation.
    
    The documentation above is typically sufficient for the intended
    purpose of executing code designed for other shells in a suitable
    environment.  More detailed rules follow.
    
    1.
        The sticky emulation environment provided by ``emulate``
        :var:`shell` ``-c`` is identical to that provided by entry to
        a function marked for sticky emulation as a consequence of being
        defined in such an environment.  Hence, for example, the sticky
        emulation is inherited by subfunctions defined within functions
        with sticky emulation.
    
    2.
        No change of options takes place on entry to or exit from
        functions that are not marked for sticky emulation, other than those
        that would normally take place, even if those functions are called
        within sticky emulation.
    
    3.
        No special handling is provided for functions marked for
        ``autoload`` nor for functions present in wordcode created by
        the ``zcompile`` command.
    
    4.
        The presence or absence of the ``-R`` switch to ``emulate``
        corresponds to different sticky emulation modes, so for example
        ``emulate sh -c``, ``emulate -R sh -c`` and ``emulate csh -c``
        are treated as three distinct sticky emulations.
    
    5.
        Difference in shell options supplied in addition to the
        basic emulation also mean the sticky emulations are different, so for
        example ``emulate zsh -c`` and ``emulate zsh -o cbases -c`` are
        treated as distinct sticky emulations.
    
    
    

.. index:: single: enable; Function

.. index:: single: enabling commands; Command

.. index:: single: commands, enabling; Command

``enable`` [ ``-afmprs`` ] :var:`name` ...
    
    Enable the :var:`name`\d hash table elements, presumably disabled
    earlier with ``disable``.  The default is to enable builtin commands.
    The ``-a`` option causes ``enable`` to act on regular or global aliases.
    The ``-s`` option causes ``enable`` to act on suffix aliases.
    The ``-f`` option causes ``enable`` to act on shell functions.  The ``-r``
    option causes ``enable`` to act on reserved words.  Without arguments
    all enabled hash table elements from the corresponding hash table are
    printed.  With the ``-m`` flag the arguments are taken as patterns
    (should be quoted) and all hash table elements from the corresponding
    hash table matching these patterns are enabled.  Enabled objects can be
    disabled with the ``disable`` builtin command.
    
    ``enable -p`` reenables patterns disabled with ``disable -p``.  Note
    that it does not override globbing options; for example, ``enable -p
    "~" ``does not cause the pattern character`` ~`` to be active unless
    the ``EXTENDED_GLOB`` option is also set.  To enable all possible
    patterns (so that they may be individually disabled with ``disable -p``),
    use ``setopt EXTENDED_GLOB KSH_GLOB NO_SH_GLOB``.
    

.. index:: single: eval; Function

.. index:: single: evaluating arguments as commands; Command

``eval`` [ :var:`arg` ... ]
    
    Read the arguments as input to the shell and execute the resulting
    command(s) in the current shell process.  The return status is
    the same as if the commands had been executed directly by the shell;
    if there are no :var:`args` or they contain no commands (i.e. are
    an empty string or whitespace) the return status is zero.
    

.. index:: single: exec; Function

``exec`` [ ``-cl`` ] [ ``-a`` :var:`argv0` ] [ :var:`command` [ :var:`arg` ... ] ]
    
    Replace the current shell with :var:`command` rather than forking.
    If :var:`command` is a shell builtin command or a shell function,
    the shell executes it, and exits when the command is complete.
    
    With ``-c`` clear the environment; with ``-l`` prepend ``-`` to the
    ``argv[0]`` string of the command executed (to simulate a login shell);
    with ``-a`` :var:`argv0` set the ``argv[0]`` string of the command
    executed.
    See :ref:`Precommand Modifiers`.
    
    If the option ``POSIX_BUILTINS`` is set, :var:`command` is never
    interpreted as a shell builtin command or shell function.  This
    means further precommand modifiers such as ``builtin`` and
    ``noglob`` are also not interpreted within the shell.  Hence
    :var:`command` is always found by searching the command path.
    
    .. index:: single: redirection, current shell's I/O; Command
    
    
    If :var:`command` is omitted but any redirections are specified,
    then the redirections will take effect in the current shell.
    

.. index:: single: exit; Function

``exit`` [ :var:`n` ]
    
    Exit the shell with the exit status specified by an arithmetic
    expression :var:`n`; if none
    is specified, use the exit status from the last command executed.
    .. index:: single: IGNORE_EOF, use of; Program
    
    
    An EOF condition will also cause the shell to exit, unless
    the ``IGNORE_EOF`` option is set.
    
    See notes at the end of :ref:`Signals`
    for some possibly unexpected interactions
    of the ``exit`` command with jobs.
    

.. index:: single: export; Function

``export`` [ :var:`name`\[``=``:var:`value`] ... ]
    
    The specified :var:`name`\s are marked for automatic export
    to the environment of subsequently executed commands.
    Equivalent to ``typeset -gx``.
    If a parameter specified does not
    already exist, it is created in the global scope.
    

.. index:: single: false; Function

.. index:: single: doing nothing, unsuccessfully; Command

``false`` [ :var:`arg` ... ]
    
    Do nothing and return an exit status of 1.
    

.. index:: single: fc; Function

.. index:: single: history, editing; Command

.. index:: single: editing history; Command

``fc`` [ ``-e`` :var:`ename` ] [ ``-s`` ] [ ``-LI`` ] [ ``-m`` :var:`match` ] [ :var:`old`\ ``=``:var:`new` ... ] [ :var:`first` [ :var:`last` ] ]

``fc -l`` [ ``-LI`` ] [ ``-nrdfEiD`` ] [ ``-t`` :var:`timefmt` ] [ ``-m`` :var:`match` ]

      [ :var:`old`\ ``=``:var:`new` ... ] [ :var:`first` [ :var:`last` ] ]

``fc -p`` [ ``-a`` ] [ :var:`filename` [ :var:`histsize` [ :var:`savehistsize` ] ] ]

``fc`` ``-P``

``fc`` ``-ARWI`` [ :var:`filename` ]
    
    The ``fc`` command controls the interactive history mechanism.  Note
    that reading and writing of history options is only performed if the
    shell is interactive.  Usually this is detected automatically, but
    it can be forced by setting the ``interactive`` option when starting the
    shell.
    
    The first two forms of this command select a range of events from
    :var:`first` to :var:`last` from the history list.  The arguments :var:`first`
    and :var:`last` may be specified as a number or as a string.  A negative
    number is used as an offset to the current history event number.  A string
    specifies the most recent event beginning with the given string.  All
    substitutions :var:`old`\ ``=``:var:`new`, if any, are then performed on the
    text of the events.
    
    The range of events selected by numbers can be narrowed further by the
    following flags.
    
    ``-I``
        restricts to only internal events (not from ``$HISTFILE``)
    
    ``-L``
        restricts to only local events (not from other shells, see
        ``SHARE_HISTORY`` in
        :manpage:`zshoptions` -- note that ``$HISTFILE`` is
        considered local when read at startup)
    
    ``-m``
        takes the first argument as a pattern (which should be
        quoted) and only the history events matching this pattern are considered
    
    
    
    If :var:`first` is not specified, it will be set to -1 (the most recent
    event), or to -16 if the ``-l`` flag is given.
    If :var:`last` is not specified, it will be set to :var:`first`,
    or to -1 if the ``-l`` flag is given.
    However, if the current event has added entries to the history with
    ``print -s`` or ``fc -R``, then the default :var:`last` for ``-l``
    includes all new history entries since the current event began.
    
    When the ``-l`` flag is given, the resulting events are listed on
    standard output.  Otherwise the editor program specified by ``-e`` :var:`ename`
    is invoked on a file containing these history events.  If ``-e`` is not given, the
    value of the parameter ``FCEDIT`` is used; if that is not set the value of
    the parameter ``EDITOR`` is used; if that is not set a builtin default,
    usually ``vi`` is used.  If :var:`ename` is ``-``, no editor is invoked.
    When editing is complete, the edited command is executed.
    
    The flag ``-s`` is equivalent to ``-e -``.
    The flag ``-r`` reverses the order of the events and the
    flag ``-n`` suppresses event numbers when listing.
    
    Also when listing,
    
    ``-d``
        prints timestamps for each event
    
    ``-f``
        prints full time-date stamps in the US
        :var:`MM`\ ``/``:var:`DD`\ ``/``:var:`YY` :var:`hh`\ ``:``:var:`mm` format
    
    ``-E``
        prints full time-date stamps in the European
        :var:`dd`\ ``.``:var:`mm`\ ``.``:var:`yyyy` :var:`hh`\ ``:``:var:`mm` format
    
    ``-i``
        prints full time-date stamps in ISO8601
        :var:`yyyy`\ ``-``:var:`mm`\ ``-``:var:`dd` :var:`hh`\ ``:``:var:`mm` format
    
    ``-t`` :var:`fmt`
        prints time and date stamps in the given format;
        :var:`fmt` is formatted with the strftime function with the zsh extensions
        described for the ``%D{``:var:`string`\ ``}`` prompt format in
        :ref:`Simple Prompt Escapes`.
        The resulting formatted string must be
        no more than 256 characters or will not be printed
        
    
    ``-D``
        prints elapsed times; may be combined with one of the
        options above
    
    
    
    .. index:: single: history, stack; Command
    
    
    .. index:: single: stack, history; Command
    
    
    ``fc -p`` pushes the current history list onto a stack and switches to a
    new history list.  If the ``-a`` option is also specified, this history list
    will be automatically popped when the current function scope is exited, which
    is a much better solution than creating a trap function to call ``fc -P``
    manually.  If no arguments are specified, the history list is left empty,
    ``$HISTFILE`` is unset, and ``$HISTSIZE`` & ``$SAVEHIST`` are set to their
    default values.  If one argument is given, ``$HISTFILE`` is set to that
    filename, ``$HISTSIZE`` & ``$SAVEHIST`` are left unchanged, and the history
    file is read in (if it exists) to initialize the new list.  If a second
    argument is specified, ``$HISTSIZE`` & ``$SAVEHIST`` are instead set to the
    single specified numeric value.  Finally, if a third argument is specified,
    ``$SAVEHIST`` is set to a separate value from ``$HISTSIZE``.  You are free to
    change these environment values for the new history list however you desire
    in order to manipulate the new history list.
    
    ``fc -P`` pops the history list back to an older list saved by ``fc -p``.
    The current list is saved to its ``$HISTFILE`` before it is destroyed
    (assuming that ``$HISTFILE`` and ``$SAVEHIST`` are set appropriately, of
    course).  The values of ``$HISTFILE``, ``$HISTSIZE``, and ``$SAVEHIST`` are
    restored to the values they had when ``fc -p`` was called.  Note that this
    restoration can conflict with making these variables "local", so your best
    bet is to avoid local declarations for these variables in functions that use
    ``fc -p``.  The one other guaranteed-safe combination is declaring these
    variables to be local at the top of your function and using the automatic
    option (``-a``) with ``fc -p``.  Finally, note that it is legal to manually
    pop a push marked for automatic popping if you need to do so before the
    function exits.
    
    .. index:: single: history, file; Command
    
    
    .. index:: single: file, history; Command
    
    
    ``fc -R`` reads the history from the given file,
    ``fc -W`` writes the history out to the given file,
    and ``fc -A`` appends the history out to the given file.
    If no filename is specified, the ``$HISTFILE`` is assumed.
    If the ``-I`` option is added to ``-R``, only those events that are
    not already contained within the internal history list are added.
    If the ``-I`` option is added to ``-A`` or ``-W``, only those
    events that are new since last incremental append/write to
    the history file are appended/written.
    In any case, the created file will have no more than ``$SAVEHIST``
    entries.
    

.. index:: single: fg; Function

.. index:: single: jobs, foregrounding; Command

.. index:: single: jobs, resuming; Command

``fg`` [ :var:`job` ... ]

:var:`job` ...
    
    Bring each specified :var:`job` in turn to the foreground.
    If no :var:`job` is specified, resume the current job.
    

.. index:: single: float; Function

``float`` [ {``+|-}Hghlprtux`` ] [ {``+|-}EFLRZ`` [ :var:`n` ] ] [ :var:`name`\[``=``:var:`value`] ... ]
    
    Equivalent to ``typeset -E``, except that options irrelevant to floating
    point numbers are not permitted.
    

.. index:: single: functions; Function

``functions`` [ {``+|-}UkmtTuWz`` ] [ ``-x`` :var:`num` ] [ :var:`name` ... ]

``functions -c`` :var:`oldfn` :var:`newfn`

``functions -M`` [``-s``] :var:`mathfn` [ :var:`min` [ :var:`max` [ :var:`shellfn` ] ] ]

``functions -M`` [ ``-m`` :var:`pattern` ... ]

``functions +M`` [ ``-m`` ] :var:`mathfn` ...
    
    Equivalent to ``typeset -f``, with the exception of the ``-c``, ``-x``,
    ``-M`` and ``-W`` options.  For ``functions -u`` and ``functions -U``,
    see ``autoload``, which provides additional options.  For ``functions -t``
    and ``functions -T``, see ``typeset -f``.
    
    The ``-x`` option indicates that any functions output will have
    each leading tab for indentation, added by the shell to show syntactic
    structure, expanded to the given number :var:`num` of spaces.  :var:`num`
    can also be 0 to suppress all indentation.
    
    The ``-W`` option turns on the option ``WARN_NESTED_VAR`` for the named
    function or functions only.  The option is turned off at the start of
    nested functions (apart from anonymous functions) unless the called
    function also has the ``-W`` attribute.
    
    The ``-c`` option causes :var:`oldfn` to be copied to :var:`newfn`.  The
    copy is efficiently handled internally by reference counting.  If
    :var:`oldfn` was marked for autoload it is first loaded and if this
    fails the copy fails.  Either function may subsequently be redefined
    without affecting the other.  A typical idiom is that :var:`oldfn` is the
    name of a library shell function which is then redefined to call
    ``newfn``, thereby installing a modified version of the function.
    
    :emphasis:`The `\ ``-M``:emphasis:` and `\ ``+M``:emphasis:` flags`
    .. index:: single: defining mathematical functions; Command
    
    
    .. index:: single: functions, defining mathematical; Command
    
    
    
    Use of the ``-M`` option may not be combined with any of the options
    handled by ``typeset -f``.
    
    ``functions -M`` :var:`mathfn` defines :var:`mathfn` as the name of
    a mathematical function recognised in all forms of arithmetical expressions;
    see :ref:`Arithmetic Evaluation`.
    By default :var:`mathfn` may take
    any number of comma-separated arguments.  If :var:`min` is given,
    it must have exactly :var:`min` args; if :var:`min` and :var:`max` are
    both given, it must have at least :var:`min` and at most :var:`max`
    args.  :var:`max` may be -1 to indicate that there is no upper limit.
    
    By default the function is implemented by a shell function of the same
    name; if :var:`shellfn` is specified it gives the name of the corresponding
    shell function while :var:`mathfn` remains the name used in arithmetical
    expressions.  The name of the function in ``$0`` is :var:`mathfn` (not
    :var:`shellfn` as would usually be the case), provided the option
    ``FUNCTION_ARGZERO`` is in effect.  The positional parameters in the shell
    function correspond to the arguments of the mathematical function call.
    
    The result of the last arithmetical expression evaluated inside the shell
    function gives the result of the mathematical function.  This is not limited to
    arithmetic substitutions of the form ``$((``:var:`...`\ ``))``,
    but also includes arithmetical expressions evaluated in any other way, including
    by the ``let`` builtin,
    by ``((``:var:`...`\ ``))`` statements,
    and even
    by the ``return`` builtin
    and
    by array subscripts.
    Therefore, care must be taken not to use syntactical constructs that perform
    arithmetic evaluation after evaluating what is to be the result of the function.
    For example:
    
    .. index:: single: zmath_cube; Function
    
    
    .. index:: single: cube; Function
    
    
    .. parsed-literal::
       :class: example
    

        # WRONG
        zmath_cube() {
          (( $1 * $1 * $1 ))
          return 0
        }
        functions -M cube 1 1 zmath_cube
        print $(( cube(3) ))
    
    
    This will print ``0`` because of the ``return``.
    
    Commenting the ``return`` out would lead to a different problem: the
    ``((``:var:`...`\ ``))`` statement would become
    the last statement in the function, so the :emphasis:`return status` (``$?``) of the
    function would be non-zero (indicating failure) whenever the :emphasis:`arithmetic
    result` of the function would happen to be zero (numerically):
    
    .. parsed-literal::
       :class: example
    

        # WRONG
        zmath_cube() {
          (( $1 * $1 * $1 ))
        }
        functions -M cube 1 1 zmath_cube
        print $(( cube(0) ))
    
    
    Instead, the ``true`` builtin can be used:
    
    .. parsed-literal::
       :class: example
    

        # RIGHT
        zmath_cube() {
          (( $1 * $1 * $1 ))
          true
        }
        functions -M cube 1 1 zmath_cube
        print $(( cube(3) ))
    
    
    If the additional option ``-s`` is given to ``functions -M``, the
    argument to the function is a single string: anything between the
    opening and matching closing parenthesis is passed to the function as a
    single argument, even if it includes commas or white space.  The minimum
    and maximum argument specifiers must therefore be 1 if given.  An empty
    argument list is passed as a zero-length string.
    Thus, the following string function takes a single argument, including
    the commas, and prints 11:
    
    .. parsed-literal::
       :class: example
    

        stringfn() { (( $#1 )); true }
        functions -Ms stringfn
        print $(( stringfn(foo,bar,rod) ))
    
    
    ``functions -M`` with no arguments lists all such user-defined functions in
    the same form as a definition.  With the additional option ``-m`` and
    a list of arguments, all functions whose :var:`mathfn` matches one of
    the pattern arguments are listed.
    
    ``function +M`` removes the list of mathematical functions; with the
    additional option ``-m`` the arguments are treated as patterns and
    all functions whose :var:`mathfn` matches the pattern are removed.  Note
    that the shell function implementing the behaviour is not removed
    (regardless of whether its name coincides with :var:`mathfn`).
    

``getcap``
    
    See :ref:`The zsh/cap Module`.
    

.. index:: single: getln; Function

.. index:: single: line, reading; Command

.. index:: single: reading a line; Command

``getln`` [ ``-AclneE`` ] :var:`name` ...
    
    Read the top value from the buffer stack and put it in
    the shell parameter :var:`name`.  Equivalent to
    ``read -zr``.
    

.. index:: single: getopts; Function

.. index:: single: options, processing; Command

``getopts`` [ ``-p`` ] :var:`optstring` :var:`name` [ :var:`arg` ... ]
    
    Checks the :var:`arg`\s for legal options.  If the :var:`arg`\s are omitted,
    the positional parameters are used.  A valid option argument
    begins with a ``+`` or a ``-``.  An argument not beginning with
    a ``+`` or a ``-``, or the argument ``--``, ends the options.
    Note that a single ``-`` is not considered a valid option argument.
    :var:`optstring` contains the letters that ``getopts``
    recognizes.  If a letter is followed by a ``:``, that option
    requires an argument.  The argument may appear either immediately
    following the option in the same word, or in the next word.
    
    Each time it is invoked, ``getopts`` places the option letter it finds
    in the shell parameter :var:`name`, prepended with a ``+`` when
    :var:`arg` begins with a ``+``.  The index of the next :var:`arg`
    is stored in ``OPTIND``.  The option argument, if any,
    is stored in ``OPTARG``.
    .. index:: single: OPTIND, use of; Variable
    
    
    .. index:: single: OPTARG, use of; Variable
    
    
    
    When the terminator ``--`` is encountered, ``OPTIND`` is
    incremented such that it can be ``shift``\ed away with the options.  This
    is not true of other non-option arguments, including a single ``-``.
    
    The first option to be examined may be changed by explicitly assigning
    to ``OPTIND``.  ``OPTIND`` has an initial value of ``1``, and is
    normally set to ``1`` upon entry to a shell function and restored
    upon exit.  ``OPTARG`` is not reset and retains its value from the most
    recent call to ``getopts``.  If either of ``OPTIND`` or ``OPTARG`` is
    explicitly unset, it remains unset, and the index or option argument is
    not stored.  The option itself is still stored in :var:`name` in this case.
    
    A leading ``:`` in :var:`optstring` causes ``getopts`` to store the
    letter of any invalid option in ``OPTARG``, and to set :var:`name` to
    ``?`` for an unknown option and to ``:`` when a required argument is
    missing.  Otherwise, ``getopts`` sets :var:`name` to ``?`` and prints
    an error message when an option is invalid.  The exit status is
    nonzero when there are no more options.
    
    When either the ``POSIX_BUILTINS`` option is enabled or the ``-p``
    option is given to ``getopts`` itself, ``getopts`` behaves in a more
    POSIX-compatible manner.  Specifically, handling of
    ``+``-prefixed options is disabled (they are treated as
    non-options) and the value of ``OPTIND`` is calculated differently.
    Additionally, with ``POSIX_BUILTINS`` (but not with ``-p``), the value
    of ``OPTIND`` is not kept local to the calling function.
    

.. index:: single: hash; Function

``hash`` [ ``-Ldfmrv`` ] [ :var:`name`\[``=``:var:`value`] ] ...
    
    ``hash`` can be used to directly modify the contents of the command
    hash table, and the named directory hash table.  Normally one would
    modify these tables by modifying one's ``PATH``
    (for the command hash table) or by creating appropriate shell parameters
    (for the named directory hash table).
    The choice of hash table to work on is determined by the ``-d`` option;
    without the option the command hash table is used, and with the option the
    named directory hash table is used.
    
    A command :var:`name` starting with a ``/`` or with a relative path
    starting with ``./`` or ``../`` is never executed by lookup in
    the command hash table, and these can only be added to the table by
    explicit use of the ``hash`` command.  Such a command is always
    found by direct look up in the file system.
    
    Given no arguments, and neither the ``-r`` or ``-f`` options,
    the selected hash table will be listed in full.
    
    The ``-r`` option causes the selected hash table to be emptied.
    It will be subsequently rebuilt in the normal fashion.
    The ``-f`` option causes the selected hash table to be fully
    rebuilt immediately.  For the command hash table this hashes
    all (and :emphasis:`only`) the absolute directories in the ``PATH``,
    and for the named directory hash table this adds all users' home
    directories.
    These two options cannot be used with any arguments.
    Both options remove any explicitly-added elements.
    
    The ``-m`` option causes the arguments to be taken as patterns
    (which should be quoted) and the elements of the hash table
    matching those patterns are printed.  This is the only way to display
    a limited selection of hash table elements.
    
    For each :var:`name` with a corresponding :var:`value`, put :var:`name` in
    the selected hash table, associating it with the pathname :var:`value`.
    In the command hash table, this means that
    whenever :var:`name` is used as a command argument, the shell will try
    to execute the file given by :var:`value`.
    In the named directory hash table, this means
    that :var:`value` may be referred to as ``~``:var:`name`.
    
    For each :var:`name` with no
    corresponding :var:`value`, attempt to add :var:`name` to the hash table,
    checking what the appropriate ``value`` is in the normal manner for
    that hash table.  If an appropriate ``value`` can't be found, then
    the hash table will be unchanged.
    
    The ``-v`` option causes hash table entries to be listed as they are
    added by explicit specification.  If has no effect if used with ``-f``.
    
    If the ``-L`` flag is present, then each hash table entry is printed in
    the form of a call to hash.
    

.. index:: single: history; Function

``history``
    
    Same as ``fc -l``.
    

.. index:: single: integer; Function

``integer`` [ {``+|-}Hghlprtux`` ] [ {``+|-}LRZi`` [ :var:`n` ] ] [ :var:`name`\[``=``:var:`value`] ... ]
    
    Equivalent to ``typeset -i``, except that options irrelevant to
    integers are not permitted.
    

.. index:: single: jobs; Function

``jobs`` [ ``-dlprs`` ] [ :var:`job` ... ]

``jobs -Z`` :var:`string`
    
    Lists information about each given job, or all jobs
    if :var:`job` is omitted.  The ``-l`` flag lists process
    IDs, and the ``-p`` flag lists process groups.
    If the ``-r`` flag is specified only running jobs will be listed
    and if the ``-s`` flag is given only stopped jobs are shown.
    If the ``-d`` flag is given, the directory from which the job was
    started (which may not be the current directory of the job) will also
    be shown.
    
    The ``-Z`` option replaces the shell's argument and environment space with
    the given string, truncated if necessary to fit.  This will normally be
    visible in ``ps`` (:manpage:`ps(1)`) listings.  This feature is typically
    used by daemons, to indicate their state.
    
    Full job control is only available in the top-level interactive shell,
    not in commands run in the left hand side of pipelines or within
    the ``(``:var:`...`\ ``)`` construct.  However, a snapshot
    of the job state at that point is taken, so it is still possible
    to use the ``jobs`` builtin, or any parameter providing job information.
    This gives information about the state of jobs at the point the subshell
    was created.  If background processes are created within the subshell,
    then instead information about those processes is provided.
    
    For example,
    
    .. parsed-literal::
       :class: example
    

        sleep 10 &    # Job in background
        (             # Shell forks
        jobs          # Shows information about "sleep 10 &"
        sleep 5 &     # Process in background (no job control)
        jobs          # Shows information about "sleep 5 &"
        )
    
    

.. index:: single: kill; Function

.. index:: single: killing jobs; Command

.. index:: single: jobs, killing; Command

``kill`` [ ``-s`` :var:`signal_name` | ``-n`` :var:`signal_number` | ``-``:var:`sig` ] [ ``-q`` :var:`value` ] :var:`job` ...

``kill`` ``-l`` [ :var:`sig` ... ]

``kill`` ``-L``
    
    Sends either ``SIGTERM`` or the specified signal to the given
    jobs or processes.
    Signals are given by number or by names, with or without the ``SIG``
    prefix.
    If the signal being sent is not ``KILL`` or ``CONT``, then the job
    will be sent a ``CONT`` signal if it is stopped.
    The argument :var:`job` can be the process ID of a job
    not in the job list.
    In the second form, ``kill -l``, if :var:`sig` is not
    specified the signal names are listed.  Otherwise, for each
    :var:`sig` that is a name, the corresponding signal number is
    listed.  For each :var:`sig` that is a signal number or a number
    representing the exit status of a process which was terminated or
    stopped by a signal the name of the signal is printed.  The final
    form with ``-L`` lists each signal name with its corresponding number.
    
    On some systems, alternative signal names are allowed for a few signals.
    Typical examples are ``SIGCHLD`` and ``SIGCLD`` or ``SIGPOLL`` and
    ``SIGIO``, assuming they correspond to the same signal number.  ``kill
    -l ``will only list the preferred form, however`` kill -l`` :var:`alt` will
    show if the alternative form corresponds to a signal number.  For example,
    under Linux ``kill -l IO`` and ``kill -l POLL`` both output 29, hence
    ``kill -IO`` and ``kill -POLL`` have the same effect.
    
    Many systems will allow process IDs to be negative to kill a process
    group or zero to kill the current process group.
    
    The ``-q`` option allows an integer value to be sent with the signal
    on systems that support ``sigqueue()``.
    

.. index:: single: let; Function

``let`` :var:`arg` ...
    
    Evaluate each :var:`arg` as an arithmetic expression.
    See :ref:`Arithmetic Evaluation`
    for a description of arithmetic expressions.  The exit status is 0 if the
    value of the last expression is nonzero, 1 if it is zero, and 2 if
    an error occurred.
    

.. index:: single: limit; Function

.. index:: single: resource limits; Command

.. index:: single: limits, resource; Command

``limit`` [ ``-hs`` ] [ :var:`resource` [ :var:`limit` ] ] ...
    
    Set or display resource limits.  Unless the ``-s`` flag is given,
    the limit applies only the children of the shell.  If ``-s`` is
    given without other arguments, the resource limits of the current
    shell is set to the previously set resource limits of the children.
    
    If :var:`limit` is not specified, print the current limit placed
    on :var:`resource`, otherwise
    set the limit to the specified value.  If the ``-h`` flag
    is given, use hard limits instead of soft limits.
    If no :var:`resource` is given, print all limits.
    
    When looping over multiple resources, the shell will abort immediately if
    it detects a badly formed argument.  However, if it fails to set a limit
    for some other reason it will continue trying to set the remaining limits.
    
    :var:`resource` can be one of:
    
    
    ``addressspace``
        Maximum amount of address space used.
    
    ``aiomemorylocked``
        Maximum amount of memory locked in RAM for AIO operations.
    
    ``aiooperations``
        Maximum number of AIO operations.
    
    ``cachedthreads``
        Maximum number of cached threads.
    
    ``coredumpsize``
        Maximum size of a core dump.
    
    ``cputime``
        Maximum CPU seconds per process.
    
    ``datasize``
        Maximum data size (including stack) for each process.
    
    ``descriptors``
        Maximum value for a file descriptor.
    
    ``filesize``
        Largest single file allowed.
    
    ``kqueues``
        Maximum number of kqueues allocated.
    
    ``maxfilelocks``
        Maximum number of file locks.
    
    ``maxproc``
        Maximum number of processes.
    
    ``maxpthreads``
        Maximum number of threads per process.
    
    ``memorylocked``
        Maximum amount of memory locked in RAM.
    
    ``memoryuse``
        Maximum resident set size.
    
    ``msgqueue``
        Maximum number of bytes in POSIX message queues.
    
    ``nice``
        Maximum nice value.
    
    ``pipebuf``
        Maximum size of buffers for pipes/fifos.
    
    ``posixlocks``
        Maximum number of POSIX locks per user.
    
    ``pseudoterminals``
        Maximum number of pseudo-terminals.
    
    ``resident``
        Maximum resident set size.
    
    ``rt_priority``
        Maximum real-time priority.
    
    ``rt_time``
        Maximum CPU time without a blocking system call.
    
    ``sigpending``
        Maximum number of pending signals.
    
    ``sockbufsize``
        Maximum size of all socket buffers.
    
    ``stacksize``
        Maximum stack size for each process.
    
    ``swapsize``
        Maximum amount of swap used.
    
    ``umtxp``
        Maximum number of POSIX thread library objects.
    
    ``vmemorysize``
        Maximum amount of virtual memory.
    
    ``vnodemonitors``
        Maximum number of open vnode monitors.
    
    
    
    Which of these resource limits are available depends on the system.
    :var:`resource` can be abbreviated to any unambiguous prefix.  It
    can also be an integer, which corresponds to the integer defined
    for the resource by the operating system.
    
    If argument corresponds to a number which is out of the range of the
    resources configured into the shell, the shell will try to read or write
    the limit anyway, and will report an error if this fails.  As the shell
    does not store such resources internally, an attempt to set the limit will
    fail unless the ``-s`` option is present.
    
    :var:`limit` is a number, with an optional scaling factor, as follows:
    
    
    :var:`n`\ ``h``
        hours
    
    :var:`n`\ ``k``
        kilobytes (default)
    
    :var:`n`\ ``m``
        megabytes or minutes
    
    :var:`n`\ ``g``
        gigabytes
    
    [:var:`mm`\ ``:``]:var:`ss`
        minutes and seconds
    
    
    
    The ``limit`` command is not made available by default when the
    shell starts in a mode emulating another shell.  It can be made available
    with the command ``zmodload -F zsh/rlimits b:limit``.
    

.. index:: single: local; Function

``local`` [ {``+|-}AHUahlprtux`` ] [ {``+|-}EFLRZi`` [ :var:`n` ] ] [ :var:`name`\[``=``:var:`value`] ... ]
    
    Same as ``typeset``, except that the options ``-g``, and
    ``-f`` are not permitted.  In this case the ``-x`` option does not force
    the use of ``-g``, i.e. exported variables will be local to functions.
    

.. index:: single: logout; Function

``logout`` [ :var:`n` ]
    
    Same as ``exit``, except that it only works in a login shell.
    

``noglob`` :var:`simple command`
    
    See :ref:`Precommand Modifiers`.
    

.. index:: single: popd; Function

``popd`` [ ``-q`` ] [ {``+|-``}:var:`n` ]
    
    Remove an entry from the directory stack, and perform a ``cd`` to
    the new top directory.  With no argument, the current top entry is
    removed.  An argument of the form ``+``:var:`n` identifies a stack
    entry by counting from the left of the list shown by the ``dirs`` command,
    starting with zero.  An argument of the form ``-``:var:`n` counts from the right.
    .. index:: single: PUSHD_MINUS, use of; Program
    
    
    If the ``PUSHD_MINUS`` option is set, the meanings of ``+`` and
    ``-`` in this context are swapped.
    
    If the ``-q`` (quiet) option is specified, the hook function ``chpwd``
    and the functions in the array ``$chpwd_functions`` are not called,
    and the new directory stack is not printed.  This is useful for calls to
    ``popd`` that do not change the environment seen by an interactive user.
    

.. index:: single: print; Function

``print`` [ ``-abcDilmnNoOpPrsSz`` ] [ ``-u`` :var:`n` ] [ ``-f`` :var:`format` ] [ ``-C`` :var:`cols` ]

      [ ``-v`` :var:`name` ] [ ``-xX`` :var:`tabstop` ] [ ``-R`` [ ``-en`` ]] [ :var:`arg` ... ]
    
    With the ``-f`` option the arguments are printed as described by ``printf``.
    With no flags or with the flag ``-``, the arguments are printed on
    the standard output as described by ``echo``, with the following differences:
    the escape sequence ``\M-``:var:`x` (or ``\M``:var:`x`) metafies the character
    :var:`x` (sets the highest bit),
    ``\C-``:var:`x` (or ``\C``:var:`x`) produces a control character
    (``\C-@`` and ``\C-?`` give the characters NULL and delete),
    a character code in octal is represented by ``\``:var:`NNN`
    (instead of ``\0``:var:`NNN`),
    and ``\E`` is a synonym for ``\e``.
    Finally, if not in an escape
    sequence, ``\`` escapes the following character and is not printed.
    
    
    ``-a``
        
        Print arguments with the column incrementing first.  Only useful with the
        ``-c`` and ``-C`` options.
        
    
    ``-b``
        
        Recognize all the escape sequences defined for the ``bindkey`` command,
        see :ref:`Zle Builtins`.
        
    
    ``-c``
        
        Print the arguments in columns.  Unless ``-a`` is also given, arguments are
        printed with the row incrementing first.
        
    
    ``-C`` :var:`cols`
        
        Print the arguments in :var:`cols` columns.  Unless ``-a`` is also given,
        arguments are printed with the row incrementing first.
        
    
    ``-D``
        
        Treat the arguments as paths, replacing directory prefixes with ``~``
        expressions corresponding to directory names, as appropriate.
        
    
    ``-i``
        
        If given together with ``-o`` or ``-O``, sorting is performed
        case-independently.
        
    
    ``-l``
        
        Print the arguments separated by newlines instead of spaces.  Note: if
        the list of arguments is empty, ``print -l`` will still output one empty
        line. To print a possibly-empty list of arguments one per line, use
        ``print -C1``, as in ``print -rC1 -- "$list[@]"``.
        
    
    ``-m``
        
        Take the first argument as a pattern (should be quoted), and remove
        it from the argument list together with subsequent arguments that
        do not match this pattern.
        
    
    ``-n``
        
        Do not add a newline to the output.
        
    
    ``-N``
        
        Print the arguments separated and terminated by nulls. Again,
        ``print -rNC1 -- "$list[@]"`` is a canonical way to print an
        arbitrary list as null-delimited records.
        
    
    ``-o``
        
        Print the arguments sorted in ascending order.
        
    
    ``-O``
        
        Print the arguments sorted in descending order.
        
    
    ``-p``
        
        Print the arguments to the input of the coprocess.
        
    
    ``-P``
        
        Perform prompt expansion (see
        :ref:`Expansion of Prompt Sequences`).
        In combination with ``-f``,
        prompt escape sequences are parsed only within interpolated arguments,
        not within the format string.
        
    
    ``-r``
        
        Ignore the escape conventions of ``echo``.
        
    
    ``-R``
        
        Emulate the BSD ``echo`` command, which does not process escape sequences
        unless the ``-e`` flag is given.  The ``-n`` flag suppresses the trailing
        newline.  Only the ``-e`` and ``-n`` flags are recognized after
        ``-R``; all other arguments and options are printed.
        
    
    ``-s``
        
        Place the results in the history list instead of on the standard output.
        Each argument to the ``print`` command is treated as a single word in the
        history, regardless of its content.
        
    
    ``-S``
        
        Place the results in the history list instead of on the standard output.
        In this case only a single argument is allowed; it will be split into
        words as if it were a full shell command line.  The effect is
        similar to reading the line from a history file with the
        ``HIST_LEX_WORDS`` option active.
        
    
    ``-u`` :var:`n`
        
        Print the arguments to file descriptor :var:`n`.
        
    
    ``-v`` :var:`name`
        
        Store the printed arguments as the value of the parameter :var:`name`.
        
    
    ``-x`` :var:`tab-stop`
        
        Expand leading tabs on each line of output in the printed string
        assuming a tab stop every :var:`tab-stop` characters.  This is appropriate
        for formatting code that may be indented with tabs.  Note that leading
        tabs of any argument to print, not just the first, are expanded, even if
        ``print`` is using spaces to separate arguments (the column count
        is maintained across arguments but may be incorrect on output
        owing to previous unexpanded tabs).
        
        The start of the output of each print command is assumed to be aligned
        with a tab stop.  Widths of multibyte characters are handled if the
        option ``MULTIBYTE`` is in effect.  This option is ignored if other
        formatting options are in effect, namely column alignment or
        ``printf`` style, or if output is to a special location such as shell
        history or the command line editor.
        
    
    ``-X`` :var:`tab-stop`
        
        This is similar to ``-x``, except that all tabs in the printed string
        are expanded.  This is appropriate if tabs in the arguments are
        being used to produce a table format.
        
    
    ``-z``
        
        Push the arguments onto the editing buffer stack, separated by spaces.
        
    
    
    
    If any of ``-m``, ``-o`` or ``-O`` are used in combination with
    ``-f`` and there are no arguments (after the removal process in the
    case of ``-m``) then nothing is printed.
    

.. index:: single: printf; Function

``printf`` [ ``-v`` :var:`name` ] :var:`format` [ :var:`arg` ... ]
    
    Print the arguments according to the format specification. Formatting
    rules are the same as used in C. The same escape sequences as for ``echo``
    are recognised in the format. All C conversion specifications ending in
    one of ``csdiouxXeEfgGn`` are handled. In addition to this, ``%b`` can be
    used instead of ``%s`` to cause escape sequences in the argument to be
    recognised and ``%q`` can be used to quote the argument in such a way
    that allows it to be reused as shell input. With the numeric format
    specifiers, if the corresponding argument starts with a quote character,
    the numeric value of the following character is used as the number to
    print; otherwise the argument is evaluated as an arithmetic expression. See
    :ref:`Arithmetic Evaluation` for a description of arithmetic
    expressions. With ``%n``, the corresponding argument is taken as an
    identifier which is created as an integer parameter.
    
    Normally, conversion specifications are applied to each argument in order
    but they can explicitly specify the :var:`n`\th argument is to be used by
    replacing ``%`` by ``%``:var:`n`\ ``$`` and ``*`` by ``*``:var:`n`\ ``$``.
    It is recommended that you do not mix references of this explicit style
    with the normal style and the handling of such mixed styles may be subject
    to future change.
    
    If arguments remain unused after formatting, the format string is reused
    until all arguments have been consumed. With the ``print`` builtin, this
    can be suppressed by using the ``-r`` option. If more arguments are
    required by the format than have been specified, the behaviour is as if
    zero or an empty string had been specified as the argument.
    
    The ``-v`` option causes the output to be stored as the value of the
    parameter :var:`name`, instead of printed. If :var:`name` is an array and
    the format string is reused when consuming arguments then one
    array element will be used for each use of the format string.
    

.. index:: single: pushd; Function

.. index:: single: PUSHD_TO_HOME, use of; Program

.. index:: single: PUSHD_MINUS, use of; Program

.. index:: single: CDABLE_VARS, use of; Program

.. index:: single: PUSHD_SILENT, use of; Program

``pushd`` [ ``-qsLP`` ] [ :var:`arg` ]

``pushd`` [ ``-qsLP`` ] :var:`old` :var:`new`

``pushd`` [ ``-qsLP`` ] {``+|-``}:var:`n`
    
    Change the current directory, and push the old current directory
    onto the directory stack.  In the first form, change the
    current directory to :var:`arg`.
    If :var:`arg` is not specified, change to the second directory
    on the stack (that is, exchange the top two entries), or
    change to ``$HOME`` if the ``PUSHD_TO_HOME``
    option is set or if there is only one entry on the stack.
    Otherwise, :var:`arg` is interpreted as it would be by ``cd``.
    The meaning of :var:`old` and :var:`new` in the second form is also
    the same as for ``cd``.
    
    The third form of ``pushd`` changes directory by rotating the
    directory list.  An argument of the form ``+``:var:`n` identifies a stack
    entry by counting from the left of the list shown by the ``dirs``
    command, starting with zero.  An argument of the form ``-``:var:`n` counts
    from the right.  If the ``PUSHD_MINUS`` option is set, the meanings
    of ``+`` and ``-`` in this context are swapped.
    
    If the ``-q`` (quiet) option is specified, the hook function ``chpwd``
    and the functions in the array ``$chpwd_functions`` are not called,
    and the new directory stack is not printed.  This is useful for calls to
    ``pushd`` that do not change the environment seen by an interactive user.
    
    If the option ``-q`` is not specified and the shell option ``PUSHD_SILENT``
    is not set, the directory stack will be printed after a ``pushd`` is
    performed.
    
    The options ``-s``, ``-L`` and ``-P`` have the same meanings as for the
    ``cd`` builtin.
    

.. index:: single: pushln; Function

``pushln`` [ :var:`arg` ... ]
    
    Equivalent to ``print -nz``.
    

.. index:: single: pwd; Function

.. index:: single: CHASE_LINKS, use of; Program

``pwd`` [ ``-rLP`` ]
    
    Print the absolute pathname of the current working directory.
    If the ``-r`` or the ``-P`` flag is specified, or the ``CHASE_LINKS``
    option is set and the ``-L`` flag is not given, the printed path will not
    contain symbolic links.
    

.. index:: single: r; Function

``r``
    
    Same as ``fc -e -``.
    

.. index:: single: read; Function

.. index:: single: IFS, use of; Variable

``read`` [ ``-rszpqAclneE`` ] [ ``-t`` [ :var:`num` ] ] [ ``-k`` [ :var:`num` ] ] [ ``-d`` :var:`delim` ]

     [ ``-u`` :var:`n` ] [ [:var:`name`][``?``:var:`prompt`] ] [ :var:`name` ...  ]
    
    .. index:: single: REPLY, use of; Variable
    
    
    .. index:: single: reply, use of; Variable
    
    
    Read one line and break it into fields using the characters
    in ``$IFS`` as separators, except as noted below.
    The first field is assigned to the first :var:`name`, the second field
    to the second :var:`name`, etc., with leftover
    fields assigned to the last :var:`name`.
    If :var:`name` is omitted then
    ``REPLY`` is used for scalars and ``reply`` for arrays.
    
    
    ``-r``
        
        Raw mode: a ``\`` at the end of a line does not signify line
        continuation and backslashes in the line don't quote the following
        character and are not removed.
        
    
    ``-s``
        
        Don't echo back characters if reading from the terminal.
        
    
    ``-q``
        
        Read only one character from the terminal and set :var:`name` to
        ``y`` if this character was ``y`` or ``Y`` and to ``n`` otherwise.
        With this flag set the return status is zero only if the character was
        ``y`` or ``Y``.  This option may be used with a timeout (see ``-t``); if
        the read times out, or encounters end of file, status 2 is returned.  Input is
        read from the terminal unless one of ``-u`` or ``-p`` is present.  This option
        may also be used within zle widgets.
        
    
    ``-k`` [ :var:`num` ]
        
        Read only one (or :var:`num`) characters.  All are assigned to the first
        :var:`name`, without word splitting.  This flag is ignored when ``-q`` is
        present.  Input is read from the terminal unless one of ``-u`` or ``-p``
        is present.  This option may also be used within zle widgets.
        
        Note that despite the mnemonic \`key' this option does read full
        characters, which may consist of multiple bytes if the option
        ``MULTIBYTE`` is set.
        
    
    ``-z``
        
        Read one entry from the editor buffer stack and assign it to the first
        :var:`name`, without word splitting.  Text is pushed onto the stack with
        ``print -z`` or with ``push-line`` from the line editor (see
        :manpage:`zshzle`).
        This flag is ignored when the ``-k`` or ``-q`` flags are present.
        
    
    ``-e``
    
    ``-E``
        
        The input read is printed (echoed) to the standard output.  If the ``-e``
        flag is used, no input is assigned to the parameters.
        
    
    ``-A``
        
        The first :var:`name` is taken as the name of an array and all words are
        assigned to it.
        
    
    ``-c``
    
    ``-l``
        
        These flags are allowed only if called inside a
        function used for completion (specified with the ``-K`` flag to
        ``compctl``).  If the ``-c`` flag is given, the words of the
        current command are read. If the ``-l`` flag is given, the whole
        line is assigned as a scalar.  If both flags are present, ``-l``
        is used and ``-c`` is ignored.
        
    
    ``-n``
        
        Together with ``-c``, the number of the word the cursor is on is
        read.  With ``-l``, the index of the character the cursor is on is
        read.  Note that the command name is word number 1, not word 0,
        and that when the cursor is at the end of the line, its character
        index is the length of the line plus one.
        
    
    ``-u`` :var:`n`
        
        Input is read from file descriptor :var:`n`.
        
    
    ``-p``
        
        Input is read from the coprocess.
        
    
    ``-d`` :var:`delim`
        
        Input is terminated by the first character of :var:`delim` instead of
        by newline.  For compatibility with other shells, if :var:`delim` is an
        empty string, input is terminated at the first NUL.
        
    
    ``-t`` [ :var:`num` ]
        
        Test if input is available before attempting to read.  If :var:`num`
        is present, it must begin with a digit and will be evaluated
        to give a number of seconds, which may be a floating point number;
        in this case the read times out if input is not available within this
        time.  If :var:`num` is not present, it is taken to be zero, so that
        ``read`` returns immediately if no input is available.
        If no input is available, return status 1 and do not set any variables.
        .. only:: man
        
         
        
        This option is not available when reading from the editor buffer with
        ``-z``, when called from within completion with ``-c`` or ``-l``, with
        ``-q`` which clears the input queue before reading, or within zle where
        other mechanisms should be used to test for input.
        .. only:: man
        
         
        
        Note that read does not attempt to alter the input processing mode.  The
        default mode is canonical input, in which an entire line is read at a time,
        so usually ``read -t`` will not read anything until an entire line has
        been typed.  However, when reading from the terminal with ``-k``
        input is processed one key at a time; in this case, only availability of
        the first character is tested, so that e.g. ``read -t -k 2`` can still
        block on the second character.  Use two instances of ``read -t -k`` if
        this is not what is wanted.
        
    
    
    
    If the first argument contains a ``?``, the remainder of this
    word is used as a :var:`prompt` on standard error when the shell
    is interactive.
    
    The value (exit status) of ``read`` is 1 when an end-of-file is
    encountered, or when ``-c`` or ``-l`` is present and the command is
    not called from a ``compctl`` function, or as described for ``-q``.
    Otherwise the value is 0.
    
    The behavior of some combinations of the ``-k``, ``-p``, ``-q``, ``-u``
    and ``-z`` flags is undefined.  Presently ``-q`` cancels all the others,
    ``-p`` cancels ``-u``, ``-k`` cancels ``-z``, and otherwise ``-z``
    cancels both ``-p`` and ``-u``.
    
    The ``-c`` or ``-l`` flags cancel any and all of ``-kpquz``.
    

.. index:: single: readonly; Function

.. index:: single: parameters, marking readonly; Command

``readonly``
    
    Same as ``typeset -r``.  With the ``POSIX_BUILTINS`` option set, same
    as ``typeset -gr``.
    

.. index:: single: rehash; Function

``rehash``
    
    Same as ``hash -r``.
    

.. index:: single: return; Function

.. index:: single: functions, returning from; Command

``return`` [ :var:`n` ]
    
    Causes a shell function or ``.`` script to return to
    the invoking script with the return status specified by
    an arithmetic expression :var:`n`.  Also causes a non-interactive
    shell to exit, allowing files containing shell code to be used
    both as scripts and as autoloadable shell functions.
    For example, the following prints ``42``:
    
    .. parsed-literal::
       :class: example
    

        () { integer foo=40; return "foo + 2" }
        echo $?
    
    
    If :var:`n`
    is omitted, the return status is that of the last command
    executed.
    
    If ``return`` was executed from a trap in a ``TRAP``:var:`NAL` function,
    the effect is different for zero and non-zero return status.  With zero
    status (or after an implicit return at the end of the trap), the shell
    will return to whatever it was previously processing; with a non-zero
    status, the shell will behave as interrupted except that the return
    status of the trap is retained.  Note that the numeric value of the signal
    which caused the trap is passed as the first argument, so the statement
    ``return "128+$1"`` will return the same status as if the signal
    had not been trapped.
    

``sched``
    
    See :ref:`The zsh/sched Module`.
    

.. index:: single: set; Function

.. index:: single: parameters, listing; Command

.. index:: single: parameters, positional; Command

.. index:: single: parameters, setting array; Command

.. index:: single: array parameters, setting; Command

.. index:: single: KSH_ARRAYS, use of; Program

``set`` [ {``+|-``}:var:`options` | {``+|-}o`` [ :var:`option_name` ] ] ... [ {``+|-}A`` [ :var:`name` ] ]

    [ :var:`arg` ... ]
    
    Set the options for the shell and/or set the positional parameters, or
    declare and set an array.  If the ``-s`` option is given, it causes the
    specified arguments to be sorted before assigning them to the positional
    parameters (or to the array :var:`name` if ``-A`` is used).  With ``+s``
    sort arguments in descending order.  For the meaning of the other flags, see
    :manpage:`zshoptions`.
    Flags may be specified by name using the ``-o`` option. If no option
    name is supplied with ``-o``, the current option states are printed:  see
    the description of ``setopt`` below for more information on the format.
    With ``+o`` they are printed in a form that can be used as input
    to the shell.
    
    If the ``-A`` flag is specified, :var:`name` is set to an array containing
    the given :var:`arg`\s; if no :var:`name` is specified, all arrays are printed
    together with their values.
    
    If ``+A`` is used and :var:`name` is an array, the
    given arguments will replace the initial elements of that array; if no
    :var:`name` is specified, all arrays are printed without their values.
    
    The behaviour of arguments after ``-A`` :var:`name` or ``+A`` :var:`name`
    depends on whether the option ``KSH_ARRAYS`` is set.  If it is not set, all
    arguments following :var:`name` are treated as values for the array,
    regardless of their form.  If the option is set, normal option processing
    continues at that point; only regular arguments are treated as values for
    the array.  This means that
    
    .. parsed-literal::
       :class: example
    

        set -A array -x -- foo
    
    
    sets ``array`` to ``-x -- foo`` if ``KSH_ARRAYS`` is not set, but sets
    the array to ``foo`` and turns on the option ``-x`` if it is set.
    
    If the ``-A`` flag is not present, but there are arguments beyond the
    options, the positional parameters are set.  If the option list (if any)
    is terminated by ``--``, and there are no further arguments, the
    positional parameters will be unset.
    
    If no arguments and no ``--`` are given, then the names and values of
    all parameters are printed on the standard output.  If the only argument is
    ``+``, the names of all parameters are printed.
    
    For historical reasons, ``set -`` is treated as ``set +xv``
    and ``set -`` :var:`args` as ``set +xv --`` :var:`args` when in
    any other emulation mode than zsh's native mode.
    

``setcap``
    
    See :ref:`The zsh/cap Module`.
    

.. index:: single: setopt; Function

.. index:: single: options, setting; Command

``setopt`` [ {``+|-``}:var:`options` | {``+|-}o`` :var:`option_name` ] [ ``-m`` ] [ :var:`name` ... ]
    
    Set the options for the shell.  All options specified either
    with flags or by name are set.
    
    If no arguments are supplied, the names of all options currently set are
    printed.  The form is chosen so as to minimize the differences from the
    default options for the current emulation (the default emulation being
    native ``zsh``, shown as ``<Z>`` in
    :ref:`Description of Options`).
    Options that are on by default for the emulation are
    shown with the prefix ``no`` only if they are off, while other options are
    shown without the prefix ``no`` and only if they are on.  In addition to
    options changed from the default state by the user, any options activated
    automatically by the shell (for example, ``SHIN_STDIN`` or ``INTERACTIVE``)
    will be shown in the list.  The format is further modified by the option
    ``KSH_OPTION_PRINT``, however the rationale for choosing options with
    or without the ``no`` prefix remains the same in this case.
    
    If the ``-m`` flag is given the arguments are taken as patterns
    (which should be quoted to protect them from filename expansion), and all
    options with names matching these patterns are set.
    
    Note that a bad option name does not cause execution of subsequent shell
    code to be aborted; this behaviour is different from that of ``set
    -o``.  This is because`` set`` is regarded as a special builtin by the
    POSIX standard, but ``setopt`` is not.
    

.. index:: single: shift; Function

.. index:: single: parameters, positional; Command

``shift`` [ ``-p`` ] [ :var:`n` ] [ :var:`name` ... ]
    
    The positional parameters ``${``:var:`n`\+1``}`` ... are renamed
    to ``$1`` ..., where :var:`n` is an arithmetic expression that
    defaults to 1.
    If any :var:`name`\s are given then the arrays with these names are
    shifted instead of the positional parameters.
    
    If the option ``-p`` is given arguments are instead removed (popped)
    from the end rather than the start of the array.
    

.. index:: single: source; Function

``source`` :var:`file` [ :var:`arg` ... ]
    
    Same as ``.``, except that the current directory is always searched and
    is always searched first, before directories in ``$path``.
    

``stat``
    
    See :ref:`The zsh/stat Module`.
    

.. index:: single: suspend; Function

.. index:: single: shell, suspending; Command

.. index:: single: suspending the shell; Command

``suspend`` [ ``-f`` ]
    
    Suspend the execution of the shell (send it a ``SIGTSTP``)
    until it receives a ``SIGCONT``.
    Unless the ``-f`` option is given, this will refuse to suspend a login shell.
    

.. index:: single: test; Function

``test`` [ :var:`arg` ... ]

``[`` [ :var:`arg` ... ] ``]``
    
    Like the system version of ``test``.  Added for compatibility;
    use conditional expressions instead (see
    :ref:`Conditional Expressions`).
    The main differences between the conditional expression syntax and the
    ``test`` and ``[`` builtins are:  these commands are not handled
    syntactically, so for example an empty variable expansion may cause an
    argument to be omitted; syntax errors cause status 2 to be returned instead
    of a shell error; and arithmetic operators expect integer arguments rather
    than arithmetic expressions.
    
    The command attempts to implement POSIX and its extensions where these
    are specified.  Unfortunately there are intrinsic ambiguities in
    the syntax; in particular there is no distinction between test operators
    and strings that resemble them.  The standard attempts to resolve these
    for small numbers of arguments (up to four); for five or more arguments
    compatibility cannot be relied on.  Users are urged wherever possible to
    use the ``[[`` test syntax which does not have these ambiguities.
    

.. index:: single: times; Function

.. index:: single: shell, timing; Command

.. index:: single: timing the shell; Command

``times``
    
    Print the accumulated user and system times for the shell
    and for processes run from the shell.
    

.. index:: single: trap; Function

.. index:: single: signals, trapping; Command

.. index:: single: trapping signals; Command

``trap`` [ :var:`arg` ] [ :var:`sig` ... ]
    
    :var:`arg` is a series of commands (usually quoted to protect it from
    immediate evaluation by the shell) to be read and executed when the shell
    receives any of the signals specified by one or more :var:`sig` args.
    Each :var:`sig` can be given as a number,
    or as the name of a signal either with or without the string ``SIG``
    in front (e.g. 1, HUP, and SIGHUP are all the same signal).
    
    If :var:`arg` is ``-``, then the specified signals are reset to their
    defaults, or, if no :var:`sig` args are present, all traps are reset.
    
    If :var:`arg` is an empty string, then the specified signals
    are ignored by the shell (and by the commands it invokes).
    
    If :var:`arg` is omitted but one or more :var:`sig` args are provided (i.e.
    the first argument is a valid signal number or name), the effect is the
    same as if :var:`arg` had been specified as ``-``.
    
    The ``trap`` command with no arguments prints a list of commands
    associated with each signal.
    
    If :var:`sig` is ``ZERR`` then :var:`arg` will be executed
    after each command with a nonzero exit status.  ``ERR`` is an alias
    for ``ZERR`` on systems that have no ``SIGERR`` signal (this is the
    usual case).
    
    If :var:`sig` is ``DEBUG`` then :var:`arg` will be executed
    before each command if the option ``DEBUG_BEFORE_CMD`` is set
    (as it is by default), else after each command.  Here, a \`command' is
    what is described as a \`sublist' in the shell grammar, see
    :ref:`Simple Commands & Pipelines`.
    If ``DEBUG_BEFORE_CMD`` is set various additional features are available.
    First, it is possible to skip the next command by setting the option
    ``ERR_EXIT``; see the description of the ``ERR_EXIT`` option in
    :manpage:`zshoptions`.  Also, the shell parameter
    ``ZSH_DEBUG_CMD`` is set to the string corresponding to the command
    to be executed following the trap.  Note that this string is reconstructed
    from the internal format and may not be formatted the same way as the
    original text.  The parameter is unset after the trap is executed.
    
    If :var:`sig` is ``0`` or ``EXIT``
    and the ``trap`` statement is executed inside the body of a function,
    then the command :var:`arg` is executed after the function completes.
    The value of ``$?`` at the start of execution is the exit status of the
    shell or the return status of the function exiting.
    If :var:`sig` is ``0`` or ``EXIT``
    and the ``trap`` statement is not executed inside the body of a function,
    then the command :var:`arg` is executed when the shell terminates; the
    trap runs before any ``zshexit`` hook functions.
    
    ``ZERR``, ``DEBUG``, and ``EXIT`` traps are not executed inside other
    traps.  ``ZERR`` and ``DEBUG`` traps are kept within subshells, while
    other traps are reset.
    
    Note that traps defined with the ``trap`` builtin are slightly different
    from those defined as ``TRAP``:var:`NAL` () { ... }, as the latter have
    their own function environment (line numbers, local variables, etc.) while
    the former use the environment of the command in which they were called.
    For example,
    
    .. parsed-literal::
       :class: example
    

        trap 'print $LINENO' DEBUG
    
    
    will print the line number of a command executed after it has run, while
    
    .. parsed-literal::
       :class: example
    

        TRAPDEBUG() { print $LINENO; }
    
    
    will always print the number zero.
    
    Alternative signal names are allowed as described under ``kill`` above.
    Defining a trap under either name causes any trap under an alternative
    name to be removed.  However, it is recommended that for consistency
    users stick exclusively to one name or another.
    

.. index:: single: true; Function

.. index:: single: doing nothing, successfully; Command

``true`` [ :var:`arg` ... ]
    
    Do nothing and return an exit status of 0.
    

.. index:: single: ttyctl; Function

.. index:: single: tty, freezing; Command

``ttyctl`` [ ``-fu`` ]
    
    The ``-f`` option freezes the tty (i.e. terminal or terminal emulator), and
    ``-u`` unfreezes it.
    When the tty is frozen, no changes made to the tty settings by
    external programs will be honored by the shell, except for changes in the
    size of the screen; the shell will
    simply reset the settings to their previous values as soon as each
    command exits or is suspended.  Thus, ``stty`` and similar programs have
    no effect when the tty is frozen.  Freezing the tty does not cause
    the current state to be remembered: instead, it causes future changes
    to the state to be blocked.
    
    Without options it reports whether the terminal is frozen or not.
    
    Note that, regardless of whether the tty is frozen or not, the
    shell needs to change the settings when the line editor starts, so
    unfreezing the tty does not guarantee settings made on the
    command line are preserved.  Strings of commands run between
    editing the command line will see a consistent tty state.
    See also the shell variable ``STTY`` for a means of initialising
    the tty before running external commands and/or freezing the tty
    around a single command.
    

.. index:: single: type; Function

``type`` [ ``-wfpamsS`` ] :var:`name` ...
    
    Equivalent to ``whence -v``.
    

.. index:: single: typeset; Function

.. index:: single: parameters, setting; Command

.. index:: single: parameters, declaring; Command

``typeset`` [ {``+|-}AHUaghlmrtux`` ] [ {``+|-}EFLRZip`` [ :var:`n` ] ]

        [ ``+`` ] [ :var:`name`\[``=``:var:`value`] ... ]

``typeset {+|-}n`` [ ``-g`` ] [ {``+|-}r`` ] [ :var:`name`\[``=``:var:`value`] ... ]

``typeset -T`` [ {``+|-}Uglrux`` ] [ {``+|-}LRZp`` [ :var:`n` ] ]

        [ ``+`` | :var:`SCALAR`\[``=``:var:`value`] :var:`array`\[``=(``:var:`value` ...``)``] [ :var:`sep` ] ]

``typeset`` ``-f`` [ {``+|-}TUkmtuz`` ] [ ``+`` ] [ :var:`name` ... ]
    
    Set or display attributes and values for shell parameters.
    
    Except as noted below for control flags that change the behavior,
    a parameter is created for each :var:`name` that does not already refer
    to one.  When inside a function, a new parameter is created for every
    :var:`name` (even those that already exist), and is unset again when the
    function completes.  See :ref:`Local Parameters`.
    The same rules apply to special shell parameters, which
    retain their special attributes when made local.
    
    For each :var:`name`\ ``=``:var:`value` assignment, the parameter
    :var:`name` is set to :var:`value`.  If the assignment is omitted and :var:`name`
    does :emphasis:`not` refer to an existing parameter, a new parameter is initialized
    to empty string, zero, or empty array (as appropriate), :emphasis:`unless` the
    shell option ``TYPESET_TO_UNSET`` is set.  When that option is set,
    the parameter attributes are recorded but the parameter remains unset.
    
    If the shell option ``TYPESET_SILENT`` is not set, for each remaining
    :var:`name` that refers to a parameter that is already set, the name and
    value of the parameter are printed in the form of an assignment.
    Nothing is printed for newly-created parameters, or when any attribute
    flags listed below are given along with the :var:`name`.  Using
    ``+`` instead of minus to introduce an attribute turns it off.
    
    If no :var:`name` is present, the names and values of all parameters are
    printed.  In this case the attribute flags restrict the display to only
    those parameters that have the specified attributes, and using ``+``
    rather than ``-`` to introduce the flag suppresses printing of the values
    of parameters when there is no parameter name.
    
    All forms of the command handle scalar assignment.  Array assignment is
    possible if any of the reserved words ``declare``, ``export``, ``float``,
    ``integer``, ``local``, ``readonly`` or ``typeset`` is matched when the
    line is parsed (N.B. not when it is executed).  In this case the arguments
    are parsed as assignments, except that the ``+=`` syntax and the
    ``GLOB_ASSIGN`` option are not supported, and scalar values after ``=``
    are :emphasis:`not` split further into words, even if expanded (regardless of the
    setting of the ``KSH_TYPESET`` option; this option is obsolete).
    
    Examples of the differences between command and reserved word parsing:
    
    .. parsed-literal::
       :class: example
    

        # Reserved word parsing
        typeset svar=$(echo one word) avar=(several words)
    
    
    The above creates a scalar parameter ``svar`` and an array
    parameter ``avar`` as if the assignments had been
    
    .. parsed-literal::
       :class: example
    

        svar="one word"
        avar=(several words)
    
    
    On the other hand:
    
    .. parsed-literal::
       :class: example
    

        # Normal builtin interface
        builtin typeset svar=$(echo two words)
    
    
    The ``builtin`` keyword causes the above to use the standard builtin
    interface to ``typeset`` in which argument parsing is performed in the same
    way as for other commands.  This example creates a scalar ``svar``
    containing the value ``two`` and another scalar parameter ``words`` with
    no value.  An array value in this case would either cause an error or be
    treated as an obscure set of glob qualifiers.
    
    Arbitrary arguments are allowed if they take the form of assignments
    after command line expansion; however, these only perform scalar
    assignment:
    
    .. parsed-literal::
       :class: example
    

        var='svar=val'
        typeset $var
    
    
    The above sets the scalar parameter ``svar`` to the value ``val``.
    Parentheses around the value within ``var`` would not cause array
    assignment as they will be treated as ordinary characters when ``$var``
    is substituted.  Any non-trivial expansion in the name part of the
    assignment causes the argument to be treated in this fashion:
    
    .. parsed-literal::
       :class: example
    

        typeset {var1,var2,var3}=name
    
    
    The above syntax is valid, and has the expected effect of setting the
    three parameters to the same value, but the command line is parsed as
    a set of three normal command line arguments to ``typeset`` after
    expansion.  Hence it is not possible to assign to multiple arrays by
    this means.
    
    Note that each interface to any of the commands may be disabled
    separately.  For example, ``disable -r typeset`` disables the reserved
    word interface to ``typeset``, exposing the builtin interface, while
    ``disable typeset`` disables the builtin.  Note that disabling the
    reserved word interface for ``typeset`` may cause problems with the
    output of ``typeset -p``, which assumes the reserved word interface is
    available in order to restore array and associative array values.
    
    Unlike parameter assignment statements, ``typeset``'s exit status on an
    assignment that involves a command substitution does not reflect the exit
    status of the command substitution.  Therefore, to test for an error in
    a command substitution, separate the declaration of the parameter from its
    initialization:
    
    .. parsed-literal::
       :class: example
    

        # WRONG
        typeset var1=$(exit 1) || echo "Trouble with var1"
        
        # RIGHT
        typeset var1 && var1=$(exit 1) || echo "Trouble with var1"
        
    
    
    To initialize a parameter :var:`param` to a command output and mark it readonly,
    use ``typeset -r`` :var:`param` or ``readonly`` :var:`param` after the parameter
    assignment statement.
    
    .. index:: single: named reference; Command
    
    
    .. index:: single: reference, named; Command
    
    
    The flag ``-n`` creates a :emphasis:`named reference` to another parameter.
    The second parameter need not exist at the time the reference is
    created.  Only the ``-H``, ``-g``, and ``-r`` flags may be used in
    conjunction with ``-n``, having their usual meanings.  The ``-u``
    flag is special and may be applied to alter the scope of the reference.
    The :var:`name` so created may not be an array element nor use
    a subscript, but the :var:`value` assigned may be any valid parameter
    name syntax, even a subscripted array element (including an associative
    array element) or an array slice, which is evaluated when the named
    reference is expanded.  It is an error for a named reference to refer
    to itself, even indirectly through a chain of references.  When ``-u``
    is applied to a named reference, the parameter identified by :var:`value`
    is always found in the calling function scope rather than the current
    local scope.  In this case, if there is no such parameter in the calling
    scope, assignments to the named reference may fail, setting ``$?`` to 1.
    See :ref:`Parameter Expansion` and
    :ref:`Named References` for details of the
    behavior of named references.
    
    Local function scoping rules for ``typeset`` do apply with ``-n``,
    so a declaration within a function persists only until the end of the
    function unless ``-g -n`` is specified, and any local parameter (of
    any type) with the same :var:`name` supplants a named reference from a
    surrounding scope.
    
    A scalar parameter, including an existing named reference, may be
    converted to a new named reference by ``typeset -n`` :var:`name`, so
    the ``-p`` option must be included to display the value of a
    specific named reference :var:`name`.
    
    If no attribute flags are given, and either no :var:`name` arguments are
    present or the flag ``+m`` is used, then each parameter name printed is
    preceded by a list of the attributes of that parameter (``array``,
    ``association``, ``exported``, ``float``, ``integer``, ``readonly``,
    or ``undefined`` for autoloaded parameters not yet loaded).  If ``+m`` is
    used with attribute flags, and all those flags are introduced with
    ``+``, the matching parameter names are printed but their values
    are not.
    
    The following control flags change the behavior of ``typeset``:
    
    
    ``+``
        
        If ``+`` appears by itself in a separate word as the last option,
        then the names of all parameters (functions with ``-f``) are printed, but
        the values (function bodies) are not.  If :var:`name` arguments appear,
        both those names and their values are printed in the form of assignments.
        It is an error for any other options to follow ``+``, but the
        effect of ``+`` is as if all attribute flags which precede it were
        given with a ``+`` prefix.  For example, ``typeset -U +`` is
        equivalent to ``typeset +U`` and displays the names of all arrays having
        the uniqueness attribute, whereas ``typeset -f -U +`` displays the
        names of all autoloadable functions.  If ``+`` is the only option,
        then type information (array, readonly, etc.) is also printed for each
        parameter, in the same manner as ``typeset +m "*"``.
        
    
    ``-g``
        
        The ``-g`` (global) means that any resulting parameter will not be
        restricted to local scope.  Note that this does not necessarily mean that
        the parameter will be global, as the flag will apply to any existing
        parameter (even if unset) from an enclosing function.  This flag does not
        affect the parameter after creation, hence it has no effect when listing
        existing parameters, nor does the flag ``+g`` have any effect except in
        combination with ``-m`` (see below).
        
    
    ``-m``
        
        If the ``-m`` flag is given the :var:`name` arguments are taken as patterns
        (use quoting to prevent these from being interpreted as file patterns).
        With no attribute flags, all parameters (or functions with the ``-f``
        flag) with matching names are printed (the shell option ``TYPESET_SILENT``
        is not used in this case).
        
        If the ``+g`` flag is combined with ``-m``, a new local parameter is
        created for every matching parameter that is not already local.  Otherwise
        ``-m`` applies all other flags or assignments to the existing parameters,
        except that the ``-n`` option cannot create named references in this way.
        
        Except when assignments are made with :var:`name`\ ``=``:var:`value`, using
        ``+m`` forces the matching parameters and their attributes to be printed,
        even inside a function.  Note that ``-m`` is ignored if no patterns are
        given, so ``typeset -m`` displays attributes but ``typeset -a +m``
        does not.  Ordinary scalar string parameters have no attributes, so for
        those ``+m`` prints only the names.
        
    
    ``-p`` [ :var:`n` ]
        
        If the ``-p`` option is given, parameters and values are printed in the
        form of a typeset command with an assignment, regardless of other flags
        and options.  Note that the ``-H`` flag on parameters is respected; no
        value will be shown for these parameters.
        
        ``-p`` may be followed by an optional integer argument.  Currently
        only the value ``1`` is supported.  In this case arrays and associative
        arrays are printed with newlines between indented elements for
        readability.
        
        The names and values of readonly special parameters
        (most of the parameters marked \`<S>' in
        :ref:`Parameters Set by the Shell`,
        except those documented as settable)
        are not printed with ``-p`` because to execute those typeset commands
        would cause errors.  However, these parameters are printed when they
        have been made local to the scope where ``typeset -p`` is run.
        
    
    ``-T`` [ :var:`scalar`\[``=``:var:`value`] :var:`array`\[``=(``:var:`value` ...``)``] [ :var:`sep` ] ]
        
        This flag has a different meaning when used with ``-f``; see below.
        Otherwise the ``-T`` option requires zero, two, or three arguments to be
        present.  With no arguments, the list of parameters created in this
        fashion is shown.  With two or three arguments, the first two are the name
        of a scalar and of an array parameter (in that order) that will be tied
        together in the manner of ``$PATH`` and ``$path``.  The optional third
        argument is a single-character separator which will be used to join the
        elements of the array to form the scalar; if absent, a colon is used, as
        with ``$PATH``.  Only the first character of the separator is significant;
        any remaining characters are ignored.  Multibyte characters are not
        yet supported.
        
        Only one of the scalar and array parameters may be assigned an initial
        value (the restrictions on assignment forms described above also apply).
        
        Both the scalar and the array may be manipulated as normal.  If one is
        unset, the other will automatically be unset too.  There is no way of
        untying the variables without unsetting them, nor of converting the type
        of one of them with another ``typeset`` command; ``+T`` does not work,
        assigning an array to :var:`scalar` is an error, and assigning a scalar to
        :var:`array` sets it to be a single-element array.
        
        Note that both ``typeset -xT ...``  and ``export -T ...`` work, but
        only the scalar will be marked for export.  Setting the value using the
        scalar version causes a split on all separators (which cannot be quoted).
        It is possible to apply ``-T`` to two previously tied variables but with a
        different separator character, in which case the variables remain joined
        as before but the separator is changed.
        
        When an existing scalar is tied to a new array, the value of the scalar
        is preserved but no attribute other than export will be preserved.
        
    
    
    
    Attribute flags that transform the final value (``-L``, ``-R``, ``-Z``,
    ``-l``, ``-u``) are only applied to the expanded value at the point
    of a parameter expansion expression using ``$``.  They are not applied
    when a parameter is retrieved internally by the shell for any purpose. 
    
    The following attribute flags may be specified:
    
    
    ``-A``
        
        The names refer to associative array parameters; see
        :ref:`Array Parameters`.
        
    
    ``-L`` [ :var:`n` ]
        
        Left justify and remove leading blanks from the value when the parameter
        is expanded.
        If :var:`n` is nonzero, it defines the width of the field.
        If :var:`n` is zero, the width is determined by the width of the value of
        the first assignment.  In the case of numeric parameters, the length of the
        complete value assigned to the parameter is used to determine the width,
        not the value that would be output.
        
        The width is the count of characters, which may be multibyte characters
        if the ``MULTIBYTE`` option is in effect.  Note that the screen
        width of the character is not taken into account; if this is required,
        use padding with parameter expansion flags
        ``${(ml``:var:`...`\ ``)``:var:`...`\ ``}`` as described in
        :ref:`Parameter Expansion Flags`.
        
        When the parameter is expanded, it is filled on the right with
        blanks or truncated if necessary to fit the field.
        Note truncation can lead to unexpected results with numeric parameters.
        Leading zeros are removed if the ``-Z`` flag is also set.
        
    
    ``-R`` [ :var:`n` ]
        
        Similar to ``-L``, except that right justification is used;
        when the parameter is expanded, the field is left filled with
        blanks or truncated from the end.  May not be combined with the ``-Z``
        flag.
        
    
    ``-U``
        
        For arrays (but not for associative arrays), keep only the first
        occurrence of each duplicated value.  This may also be set for tied
        parameters (see ``-T``) or colon-separated special parameters like
        ``PATH`` or ``FIGNORE``, etc.  Note the flag takes effect on assignment,
        and the type of the variable being assigned to is determinative; for
        variables with shared values it is therefore recommended to set the flag
        for all interfaces, e.g. ``typeset -U PATH path``.
        
        This flag has a different meaning when used with ``-f``; see below.
        
    
    ``-Z`` [ :var:`n` ]
        
        Specially handled if set along with the ``-L`` flag.
        Otherwise, similar to ``-R``, except that leading zeros are used for
        padding instead of blanks if the first non-blank character is a digit.
        Numeric parameters are specially handled: they are always eligible
        for padding with zeroes, and the zeroes are inserted at an appropriate
        place in the output.
        
    
    ``-a``
        
        The names refer to array parameters.  An array parameter may be
        created this way, but it may be assigned to in the ``typeset``
        statement only if the reserved word form of ``typeset`` is enabled
        (as it is by default).  When displaying, both normal and associative
        arrays are shown.
        
    
    ``-f``
        
        The names refer to functions rather than parameters.  No assignments
        can be made, and the only other valid flags are ``-t``, ``-T``, ``-k``,
        ``-u``, ``-U`` and ``-z``.  The flag ``-t`` turns on execution tracing
        for this function; the flag ``-T`` does the same, but turns off tracing
        for any named (not anonymous) function called from the present one,
        unless that function also
        has the ``-t`` or ``-T`` flag.  The ``-u`` and ``-U`` flags cause the
        function to be marked for autoloading; ``-U`` also causes alias
        expansion to be suppressed when the function is loaded.  See the
        description of the ``autoload`` builtin for details.
        
        Note that the builtin ``functions`` provides the same basic capabilities
        as ``typeset -f`` but gives access to a few extra options; ``autoload``
        gives further additional options for the case ``typeset -fu`` and
        ``typeset -fU``.
        
    
    ``-h``
        
        Hide: only useful for special parameters (those marked \`<S>' in the table in
        :ref:`Parameters Set by the Shell`),
        and for local parameters with the same name as a special parameter,
        though harmless for others.  A special parameter with this attribute will
        not retain its special effect when made local.  Thus after ``typeset -h
        PATH``, a function containing`` typeset PATH`` will create an ordinary
        local parameter without the usual behaviour of ``PATH``.  Alternatively,
        the local parameter may itself be given this attribute; hence inside a
        function ``typeset -h PATH`` creates an ordinary local parameter and the
        special ``PATH`` parameter is not altered in any way.  It is also possible
        to create a local parameter using ``typeset +h`` :var:`special`, where the
        local copy of :var:`special` will retain its special properties regardless of
        having the ``-h`` attribute.  Global special parameters loaded from shell
        modules (for example, those in ``zsh/mapfile`` and ``zsh/parameter``) are
        automatically given the ``-h`` attribute to avoid name clashes.
        
    
    ``-H``
        
        Hide value: specifies that ``typeset`` will not display the value of the
        parameter when listing parameters; the display for such parameters is
        always as if the ``+`` flag were given, but use of the parameter is
        in other respects normal.  This effect does not apply when the parameter is
        specified by name or by pattern with the ``-m`` option.  This is on by
        default for the parameters in the ``zsh/parameter`` and ``zsh/mapfile``
        modules.  Note, however, that unlike the ``-h`` flag this is also useful
        for non-special parameters.
        
    
    ``-i`` [ :var:`n` ]
        
        Use an internal integer representation.  If :var:`n` is nonzero it
        defines the output arithmetic base, otherwise it is determined by the
        first assignment.  Bases from 2 to 36 inclusive are allowed.
        
    
    ``-E`` [ :var:`n` ]
        
        Use an internal double-precision floating point representation.  On output
        the variable will be converted to scientific notation.  If :var:`n` is
        nonzero it defines the number of significant figures to display; the
        default is ten.
        
    
    ``-F`` [ :var:`n` ]
        
        Use an internal double-precision floating point representation.  On output
        the variable will be converted to fixed-point decimal notation.  If :var:`n`
        is nonzero it defines the number of digits to display after the decimal
        point; the default is ten.
        
    
    ``-l``
        
        Convert the result to lower case whenever the parameter is expanded.
        The value is :emphasis:`not` converted when assigned.
        
    
    ``-r``
        
        The given :var:`name`\s are marked readonly.  Note that if :var:`name` is a
        special parameter, the readonly attribute can be turned on, but cannot then
        be turned off.
        
        If the ``POSIX_BUILTINS`` option is set, the readonly attribute is
        more restrictive: unset variables can be marked readonly and cannot then
        be set; furthermore, the readonly attribute cannot be removed from any
        variable.
        
        It is still possible to change other attributes of the variable though,
        some of which like ``-U`` or ``-Z`` would affect the value. More generally,
        the readonly attribute should not be relied on as a security mechanism.
        
        Note that in zsh (like in pdksh but unlike most other shells) it is
        still possible to create a local variable of the same name as this is
        considered a different variable (though this variable, too, can be marked
        readonly). Special variables that have been made readonly retain their value
        and readonly attribute when made local.
        
    
    ``-t``
        
        Tags the named parameters.  Tags only exist to flag the parameter for
        the user's own purposes --- the list of tagged parameters can be queried
        using ``typeset -t``.  Tags have no other use.  Note that the ``-t``
        flag has a different meaning when used with ``-f``; see above.
        
    
    ``-u``
        
        Convert the result to upper case whenever the parameter is expanded.
        The value is :emphasis:`not` converted when assigned.
        This flag has different meanings when used with ``-f`` or ``-n``; see above.
        
    
    ``-x``
        
        Mark for automatic export to the environment of subsequently
        executed commands.  If the option ``GLOBAL_EXPORT`` is set, this implies
        the option ``-g``, unless ``+g`` is also explicitly given; in other words
        the parameter is not made local to the enclosing function.  This is for
        compatibility with previous versions of zsh.
        
    
    
    

.. index:: single: ulimit; Function

.. index:: single: resource limits; Command

.. index:: single: limits, resource; Command

``ulimit`` [ ``-HSa`` ] [ { ``-bcdfiklmnpqrsTtvwx`` | ``-N`` :var:`resource` } [ :var:`limit` ] ... ]
    
    Set or display resource limits of the shell and the processes started by
    the shell.  The value of :var:`limit` can be a number in the unit specified
    below or one of the values ``unlimited``, which removes the limit on the
    resource, or ``hard``, which uses the current value of the hard limit on
    the resource.
    
    By default, only soft limits are manipulated. If the ``-H`` flag
    is given use hard limits instead of soft limits.  If the ``-S`` flag is given
    together with the ``-H`` flag set both hard and soft limits.
    
    If no options are used, the file size limit (``-f``) is assumed.
    
    If :var:`limit` is omitted the current value of the specified resources are
    printed.  When more than one resource value is printed, the limit name and
    unit is printed before each value.
    
    When looping over multiple resources, the shell will abort immediately if
    it detects a badly formed argument.  However, if it fails to set a limit
    for some other reason it will continue trying to set the remaining limits.
    
    Not all the following resources are supported on all systems.  Running
    ``ulimit -a`` will show which are supported.
    
    
    ``-a``
        List all of the current resource limits.
    
    ``-b``
        Socket buffer size in bytes (N.B. not kilobytes)
    
    ``-c``
        512-byte blocks on the size of core dumps.
    
    ``-d``
        Kilobytes on the size of the data segment.
    
    ``-e``
        Maximum nice value.
    
    ``-f``
        512-byte blocks on the size of files written.
    
    ``-i``
        The number of pending signals.
    
    ``-k``
        The number of kqueues allocated.
    
    ``-l``
        Kilobytes on the size of locked-in memory.
    
    ``-m``
        Kilobytes on the size of physical memory.
    
    ``-n``
        Open file descriptors.
    
    ``-o``
        Maximum number of POSIX thread library objects.
    
    ``-p``
        The number of pseudo-terminals.
    
    ``-q``
        Bytes in POSIX message queues.
    
    ``-r``
        Maximum real time priority.  On some systems where this
        is not available, such as NetBSD, this has the same effect as ``-T``
        for compatibility with ``sh``.
    
    ``-s``
        Kilobytes on the size of the stack.
    
    ``-T``
        The number of simultaneous threads available to the user.
    
    ``-t``
        CPU seconds to be used.
    
    ``-u``
        The number of processes available to the user.
    
    ``-v``
        Kilobytes on the size of virtual memory.  On some systems this
        refers to the limit called \`address space'.
    
    ``-w``
        Kilobytes on the size of swapped out memory.
    
    ``-x``
        The number of locks on files.
    
    ``-y``
        Maximum size of buffers for pipes/fifos.
    
    
    
    A resource may also be specified by integer in the form ``-N``
    :var:`resource`, where :var:`resource` corresponds to the integer defined for
    the resource by the operating system.  This may be used to set the limits
    for resources known to the shell which do not correspond to option letters.
    Such limits will be shown by number in the output of ``ulimit -a``.
    
    The number may alternatively be out of the range of limits compiled into
    the shell.  The shell will try to read or write the limit anyway, and
    will report an error if this fails.
    

.. index:: single: umask; Function

.. index:: single: umask; Command

``umask`` [ ``-S`` ] [ :var:`mask` ]
    
    The umask is set to :var:`mask`.  :var:`mask` can be either
    an octal number or a symbolic value as described in the :manpage:`chmod(1)` man page.
    If :var:`mask` is omitted, the current value is printed.  The ``-S``
    option causes the mask to be printed as a symbolic value.  Otherwise,
    the mask is printed as an octal number.  Note that in
    the symbolic form the permissions you specify are those which are to be
    allowed (not denied) to the users specified.
    

.. index:: single: unalias; Function

.. index:: single: aliases, removing; Command

``unalias`` [ ``-ams`` ] :var:`name` ...
    
    Removes aliases.  This command works the same as ``unhash -a``, except that
    the ``-a`` option removes all regular or global aliases, or with ``-s``
    all suffix aliases: in this case no :var:`name` arguments may appear.  The
    options ``-m`` (remove by pattern) and ``-s`` without ``-a`` (remove
    listed suffix aliases) behave as for ``unhash -a``.  Note that
    the meaning of ``-a`` is different between ``unalias`` and ``unhash``.
    

.. index:: single: functions, removing; Command

.. index:: single: unfunction; Function

``unfunction``
    
    Same as ``unhash -f``.
    

.. index:: single: unhash; Function

``unhash`` [ ``-adfms`` ] :var:`name` ...
    
    Remove the element named :var:`name` from an internal hash table.  The
    default is remove elements from the command hash table.  The ``-a``
    option causes ``unhash`` to remove regular or global aliases; note
    when removing a global aliases that the argument must be quoted to prevent
    it from being expanded before being passed to the command.
    The ``-s`` option causes ``unhash`` to remove suffix aliases.
    The ``-f`` option causes
    ``unhash`` to remove shell functions.  The ``-d`` options causes
    ``unhash`` to remove named directories.  If the ``-m`` flag is given
    the arguments are taken as patterns (should be quoted) and all elements
    of the corresponding hash table with matching names will be removed.
    

.. index:: single: unlimit; Function

.. index:: single: resource limits; Command

.. index:: single: limits, resource; Command

``unlimit`` [ ``-hs`` ] :var:`resource` ...
    
    The resource limit for each :var:`resource` is set to the hard limit.
    If the ``-h`` flag is given and the shell has appropriate privileges,
    the hard resource limit for each :var:`resource` is removed.
    The resources of the shell process are only changed if the ``-s``
    flag is given.
    
    The ``unlimit`` command is not made available by default when the
    shell starts in a mode emulating another shell.  It can be made available
    with the command ``zmodload -F zsh/rlimits b:unlimit``.
    

.. index:: single: unset; Function

.. index:: single: parameters, unsetting; Command

``unset`` [ ``-fmv`` ] [ ``-n`` ] :var:`name` ...
    
    Each named parameter is unset.
    Local parameters remain local even if unset; they appear unset within scope,
    but the previous value will still reappear when the scope ends.
    
    Individual elements of associative array parameters may be unset by using
    subscript syntax on :var:`name`, which should be quoted (or the entire command
    prefixed with ``noglob``) to protect the subscript from filename generation.
    
    If the ``-m`` flag is specified the arguments are taken as patterns (should
    be quoted) and all parameters with matching names are unset.  Note that this
    cannot be used when unsetting associative array elements, as the subscript
    will be treated as part of the pattern.
    
    The ``-v`` flag specifies that :var:`name` refers to parameters. This is
    the default behaviour.  If the ``-n`` option is supplied, and
    :var:`name` is a a named reference, :var:`name` will be unset rather than
    the variable it references.
    
    ``unset -f`` is equivalent to ``unfunction``.  The ``-n`` option has
    no effect with ``-f``.
    

.. index:: single: unsetopt; Function

.. index:: single: options, unsetting; Command

``unsetopt`` [ {``+|-``}:var:`options` | {``+|-}o`` :var:`option_name` ] [ :var:`name` ... ]
    
    Unset the options for the shell.  All options specified either
    with flags or by name are unset.  If no arguments are supplied,
    the names of all options currently unset are printed.
    If the ``-m`` flag is given the arguments are taken as patterns
    (which should be quoted to preserve them from being interpreted as glob
    patterns), and all options with names matching these patterns are unset.
    

``vared``
    
    See :ref:`Zle Builtins`.
    

.. index:: single: wait; Function

.. index:: single: waiting for jobs; Command

.. index:: single: jobs, waiting for; Command

``wait`` [ :var:`job` ... ]
    
    Wait for the specified jobs or processes.  If :var:`job` is not given
    then all currently active child processes are waited for.
    Each :var:`job` can be either a job specification or the process ID
    of a job in the job table.
    The exit status from this command is that of the job waited for.
    If :var:`job` represents an unknown job or process ID, a warning is printed
    (unless the ``POSIX_BUILTINS`` option is set) and the exit status is 127.
    
    It is possible to wait for recent processes (specified by process ID,
    not by job) that were running in the background even if the process has
    exited.  Typically the process ID will be recorded by capturing the
    value of the variable ``$!`` immediately after the process has been
    started.  There is a limit on the number of process IDs remembered by
    the shell; this is given by the value of the system configuration
    parameter ``CHILD_MAX``.  When this limit is reached, older process IDs
    are discarded, least recently started processes first.
    
    Note there is no protection against the process ID wrapping, i.e. if the
    wait is not executed soon enough there is a chance the process waited
    for is the wrong one.  A conflict implies both process IDs have been
    generated by the shell, as other processes are not recorded, and that
    the user is potentially interested in both, so this problem is intrinsic
    to process IDs.
    

.. index:: single: whence; Function

``whence`` [ ``-vcwfpamsS`` ] [ ``-x`` :var:`num` ] :var:`name` ...
    
    For each :var:`name`, indicate how it would be interpreted if used as a
    command name.
    
    If :var:`name` is not an alias, built-in command, external command, shell
    function, hashed command, or a reserved word, the exit status shall be
    non-zero, and -- if ``-v``, ``-c``, or ``-w`` was passed -- a message
    will be written to standard output.  (This is different from other shells that
    write that message to standard error.)
    
    ``whence`` is most useful when :var:`name` is only the last path component
    of a command, i.e. does not include a ``/``; in particular, pattern
    matching only succeeds if just the non-directory component of the command is
    passed.
    
    
    ``-v``
        
        Produce a more verbose report.
        
    
    ``-c``
        
        Print the results in a :strong:`csh`-like format.
        This takes precedence over ``-v``.
        
    
    ``-w``
        
        For each :var:`name`, print :var:`name`\ ``:`` :var:`word` where :var:`word`
        is one of ``alias``, ``builtin``, ``command``, ``function``,
        ``hashed``, ``reserved`` or ``none``, according as :var:`name`
        corresponds to an alias, a built-in command, an external command, a
        shell function, a command defined with the ``hash`` builtin, a
        reserved word, or is not recognised.  This takes precedence over
        ``-v`` and ``-c``.
        
    
    ``-f``
        
        Causes the contents of a shell function to be
        displayed, which would otherwise not happen unless the ``-c``
        flag were used.
        
    
    ``-p``
        
        Do a path search for :var:`name`
        even if it is an alias, reserved word, shell function or builtin.
        
    
    ``-a``
        
        Do a search for all occurrences of :var:`name`
        throughout the command path.
        Normally only the first occurrence is printed.
        When combined with ``-m``, only names appearing in the command hash
        table are searched, but all occurrences of those names are printed.
        
    
    ``-m``
        
        The arguments are taken as patterns (pattern characters should be
        quoted), and the information is displayed for each entry in the command
        hash table matching one of these patterns.  The hash table is first
        refilled, in case of changes to ``PATH``.
        
    
    ``-s``
        
        If a pathname contains symlinks, print the symlink-free pathname as well.
        
    
    ``-S``
        
        As ``-s``, but if the pathname had to be resolved by following
        multiple symlinks, the intermediate steps are printed, too.  The
        symlink resolved at each step might be anywhere in the path.
        
    
    ``-x`` :var:`num`
        
        Expand tabs when outputting shell functions using the ``-c`` option.
        This has the same effect as the ``-x`` option to the ``functions``
        builtin.
        
    
    
    

.. index:: single: where; Function

``where`` [ ``-wpmsS`` ] [ ``-x`` :var:`num` ] :var:`name` ...
    
    Equivalent to ``whence -ca``.
    

.. index:: single: which; Function

``which`` [ ``-wpamsS`` ] [ ``-x`` :var:`num` ] :var:`name` ...
    
    Equivalent to ``whence -c``.
    

.. index:: single: zcompile; Function

.. index:: single: .zwc files, creation; Command

.. index:: single: compilation; Command

``zcompile`` [ ``-U`` ] [ ``-z`` | ``-k`` ] [ ``-R`` | ``-M`` ] :var:`file` [ :var:`name` ... ]

``zcompile`` ``-ca`` [ ``-m`` ] [ ``-R`` | ``-M`` ] :var:`file` [ :var:`name` ... ]

``zcompile -t`` :var:`file` [ :var:`name` ... ]
    
    This builtin command can be used to compile functions or scripts,
    storing the compiled form in a file, and to examine files containing
    the compiled form.  This allows faster autoloading of functions and
    sourcing of scripts by avoiding parsing of the text when the files
    are read.
    
    The first form (without the ``-c``, ``-a`` or ``-t`` options) creates a
    compiled file.  If only the :var:`file` argument is given, the
    output file has the name :var:`file`\ ``.zwc`` and will be placed in
    the same directory as the :var:`file`.  The shell will load the compiled
    file instead of the normal function file when the function
    is autoloaded; see :ref:`Autoloading Functions`
    for a description of how autoloaded functions are searched.  The
    extension ``.zwc`` stands for \`zsh word code'.
    
    .. index:: single: fpath, with zcompile; Variable
    
    
    If there is at least one :var:`name` argument, all the named files
    are compiled into the output :var:`file` given as the first argument.  If
    :var:`file` does not end in ``.zwc``, this extension is automatically
    appended.  Files containing multiple compiled functions are called \`digest'
    files, and are intended to be used as elements of the ``FPATH/fpath``
    special array.
    
    The second form, with the ``-c`` or ``-a`` options, writes the compiled
    definitions for all the named functions into :var:`file`.  For ``-c``, the
    names must be functions currently defined in the shell, not those marked
    for autoloading.  Undefined functions that are marked for autoloading
    may be written by using the ``-a`` option, in which case the ``fpath``
    is searched and the contents of the definition files for those
    functions, if found, are compiled into :var:`file`.  If both ``-c`` and
    ``-a`` are given, names of both defined functions and functions marked
    for autoloading may be given.  In either case, the functions in files
    written with the ``-c`` or ``-a`` option will be autoloaded as if the
    ``KSH_AUTOLOAD`` option were unset.
    
    The reason for handling loaded and not-yet-loaded functions with
    different options is that some definition files for autoloading define
    multiple functions, including the function with the same name as the
    file, and, at the end, call that function.  In such cases the output of
    ``zcompile -c`` does not include the additional functions defined in
    the file, and any other initialization code in the file is lost.  Using
    ``zcompile -a`` captures all this extra information.
    
    If the ``-m`` option is combined with ``-c`` or ``-a``,
    the :var:`name`\s are used as patterns and all functions whose names
    match one of these patterns will be written. If no :var:`name` is given,
    the definitions of all functions currently defined or marked as
    autoloaded will be written.
    
    Note the second form cannot be used for compiling functions that
    include redirections as part of the definition rather than within
    the body of the function; for example
    
    .. parsed-literal::
       :class: example
    

        fn1() { { ... } >~/logfile }
    
    
    can be compiled but
    
    .. parsed-literal::
       :class: example
    

        fn1() { ... } >~/logfile
    
    
    cannot.  It is possible to use the first form of ``zcompile`` to compile
    autoloadable functions that include the full function definition instead
    of just the body of the function.
    
    The third form, with the ``-t`` option, examines an existing
    compiled file.  Without further arguments, the names of the original
    files compiled into it are listed.  The first line of output shows
    the version of the shell which compiled the file and how the file
    will be used (i.e. by reading it directly or by mapping it into memory).
    With arguments, nothing is output and the return status is set to zero if
    definitions for :emphasis:`all` :var:`name`\s were found in the compiled
    file, and non-zero if the definition for at least one :var:`name` was not
    found.
    
    Other options:
    
    
    ``-U``
        
        Aliases are not expanded when compiling the :var:`name`\d files.
        
    
    ``-R``
        
        When the compiled file is read, its contents are copied into the
        shell's memory, rather than memory-mapped (see ``-M``).  This
        happens automatically on systems that do not support memory mapping.
        
        When compiling scripts instead of autoloadable functions, it is
        often desirable to use this option; otherwise the whole file, including the
        code to define functions which have already been defined, will
        remain mapped, consequently wasting memory.
        
    
    ``-M``
        
        The compiled file is mapped into the shell's memory when read. This
        is done in such a way that multiple instances of the shell running
        on the same host will share this mapped file.  If neither ``-R`` nor
        ``-M`` is given, the ``zcompile`` builtin decides what to do based
        on the size of the compiled file.
        
    
    ``-k``
    
    ``-z``
        
        These options are used when the compiled file contains functions which
        are to be autoloaded. If ``-z`` is given, the
        function will be autoloaded as if the ``KSH_AUTOLOAD`` option is
        :emphasis:`not` set, even if it is set at the time the compiled file is
        read, while if the ``-k`` is given, the function will be loaded as if
        ``KSH_AUTOLOAD`` :emphasis:`is` set.  These options also take precedence over
        any ``-k`` or ``-z`` options specified to the ``autoload`` builtin. If
        neither of these options is given, the function will be loaded as
        determined by the setting of the ``KSH_AUTOLOAD`` option at the time
        the compiled file is read.
        .. only:: man
        
         
        
        These options may also appear as many times as necessary between the listed
        :var:`name`\s to specify the loading style of all following functions, up to
        the next ``-k`` or ``-z``.
        
    
    .. only:: not man
    
    
    
    
    The created file always contains two versions of the compiled
    format, one for big-endian machines and one for small-endian
    machines.  The upshot of this is that the compiled file is machine
    independent and if it is read or mapped, only one half of the file
    is actually used (and mapped).
    .. only:: man
    
    .. DEFINITION-LIST-END
    
    
    

``zformat``
    
    See :ref:`The zsh/zutil Module`.
    

``zftp``
    
    See :ref:`The zsh/zftp Module`.
    

``zle``
    
    See :ref:`Zle Builtins`.
    

.. index:: single: zmodload; Function

.. index:: single: modules, loading; Command

.. index:: single: loading modules; Command

``zmodload`` [ ``-dL`` ] [ ``-s`` ] [ ... ]

``zmodload -F`` [ ``-alLme`` ``-P`` :var:`param` ] :var:`module` [ [``+-``]:var:`feature` ... ]

``zmodload -e`` [ ``-A`` ] [ ... ]

``zmodload`` [ ``-a`` [ ``-bcpf`` [ ``-I`` ] ] ] [ ``-iL`` ] ...

``zmodload`` ``-u`` [ ``-abcdpf`` [ ``-I`` ] ] [ ``-iL`` ] ...

``zmodload`` ``-A`` [ ``-L`` ] [ :var:`modalias`\[``=``:var:`module`] ... ]

``zmodload`` ``-R`` :var:`modalias` ...
    
    Performs operations relating to zsh's loadable modules.
    Loading of modules while the shell is running (\`dynamical loading') is not
    available on all operating systems, or on all installations on a particular
    operating system, although the ``zmodload`` command itself is always
    available and can be used to manipulate modules built into versions of the
    shell executable without dynamical loading.
    
    Without arguments the names of all currently loaded binary modules are
    printed.  The ``-L`` option causes this list to be in the form of a
    series of ``zmodload`` commands.  Forms with arguments are:
    
    
    ``zmodload`` [ ``-is`` ] :var:`name` ... 
    
    ``zmodload`` ``-u`` [ ``-i`` ] :var:`name` ...
        
        In the simplest case, ``zmodload`` loads a binary module.  The module must
        be in a file with a name consisting of the specified :var:`name` followed by
        a standard suffix, usually ``.so`` (``.sl`` on HPUX).
        If the module to be loaded is already loaded the duplicate module is
        ignored.  If ``zmodload`` detects an inconsistency, such as an
        invalid module name or circular dependency list, the current code block is 
        aborted.  If it is available, the module is loaded if necessary, while if it
        is not available, non-zero status is silently returned.  The option
        ``-i`` is accepted for compatibility but has no effect.
        
        The :var:`name`\d module is searched for in the same way a command is, using
        ``$module_path`` instead of ``$path``.  However, the path search is
        performed even when the module name contains a ``/``, which it usually does.
        There is no way to prevent the path search.
        
        If the module supports features (see below), ``zmodload`` tries to
        enable all features when loading a module.  If the module was successfully
        loaded but not all features could be enabled, ``zmodload`` returns status 2.
        
        If the option ``-s`` is given, no error is printed if the module was not
        available (though other errors indicating a problem with the module are
        printed).  The return status indicates if the module was loaded.  This
        is appropriate if the caller considers the module optional.
        
        With ``-u``, ``zmodload`` unloads modules.  The same :var:`name`
        must be given that was given when the module was loaded, but it is not
        necessary for the module to exist in the file system.
        The ``-i`` option suppresses the error if the module is already
        unloaded (or was never loaded).
        
        Each module has a boot and a cleanup function.  The module
        will not be loaded if its boot function fails.  Similarly a module
        can only be unloaded if its cleanup function runs successfully.
        
    
    ``zmodload -F`` [ ``-almLe`` ``-P`` :var:`param` ] :var:`module` [ [``+-``]:var:`feature` ... ]
        
        ``zmodload -F`` allows more selective control over the features provided
        by modules.  With no options apart from ``-F``, the module named
        :var:`module` is loaded, if it was not already loaded, and the list of
        :var:`feature`\s is set to the required state.  If no 
        :var:`feature`\s are specified, the module is loaded, if it was not already
        loaded, but the state of features is unchanged.  Each feature
        may be preceded by a ``+`` to turn the feature on, or ``-`` to turn it
        off; the ``+`` is assumed if neither character is present.
        Any feature not explicitly mentioned is left in its current state;
        if the module was not previously loaded this means any such features will
        remain disabled.  The return status is zero if all features were
        set, 1 if the module failed to load, and 2 if some features could
        not be set (for example, a parameter couldn't be added because there
        was a different parameter of the same name) but the module was loaded.
        
        The standard features are builtins, conditions, parameters and math
        functions; these are indicated by the prefix ``b:``, ``c:``
        (``C:`` for an infix condition), ``p:`` and ``f:``, respectively,
        followed by the name that the corresponding feature would have in the
        shell.  For example, ``b:strftime`` indicates a builtin named
        ``strftime`` and ``p:EPOCHSECONDS`` indicates a parameter named
        ``EPOCHSECONDS``.  The module may provide other (\`abstract') features of
        its own as indicated by its documentation; these have no prefix.
        
        With ``-l`` or ``-L``, features provided by the module are listed.  With
        ``-l`` alone, a list of features together with their states is shown, one
        feature per line.  With ``-L`` alone, a ``zmodload -F`` command that would
        cause enabled features of the module to be turned on is shown.  With
        ``-lL``, a ``zmodload -F`` command that would cause all the features to be
        set to their current state is shown.  If one of these combinations is given
        with the option ``-P`` :var:`param` then the parameter :var:`param` is set to an
        array of features, either features together with their state or (if
        ``-L`` alone is given) enabled features.
        
        With the option ``-L`` the module name may be omitted; then a list
        of all enabled features for all modules providing features is printed
        in the form of ``zmodload -F`` commands.  If ``-l`` is also given,
        the state of both enabled and disabled features is output in that form.
        
        A set of features may be provided together with ``-l`` or ``-L`` and a
        module name; in that case only the state of those features is
        considered.  Each feature may be preceded by ``+`` or ``-`` but the
        character has no effect.  If no set of features is provided, all
        features are considered.
        
        With ``-e``, the command first tests that the module is loaded;
        if it is not, status 1 is returned.  If the module is loaded,
        the list of features given as an argument is examined.  Any feature
        given with no prefix is simply tested to see if the module provides it;
        any feature given with a prefix ``+`` or ``-`` is tested to
        see if is provided and in the given state.  If the tests on all features
        in the list succeed, status 0 is returned, else status 1.
        
        With ``-m``, each entry in the given list of features is taken
        as a pattern to be matched against the list of features provided
        by the module.  An initial ``+`` or ``-`` must be given explicitly.
        This may not be combined with the ``-a`` option as autoloads must
        be specified explicitly.
        
        With ``-a``, the given list of features is marked for autoload from
        the specified module, which may not yet be loaded.  An optional ``+``
        may appear before the feature name.  If the feature is prefixed with
        ``-``, any existing autoload is removed.  The options ``-l`` and ``-L``
        may be used to list autoloads.  Autoloading is specific to individual
        features; when the module is loaded only the requested feature is
        enabled.  Autoload requests are preserved if the module is
        subsequently unloaded until an explicit ``zmodload -Fa`` :var:`module`
        ``-``:var:`feature` is issued.  It is not an error to request an autoload
        for a feature of a module that is already loaded.
        
        When the module is loaded each autoload is checked against the features
        actually provided by the module; if the feature is not provided the
        autoload request is deleted.  A warning message is output; if the
        module is being loaded to provide a different feature, and that autoload
        is successful, there is no effect on the status of the current command.
        If the module is already loaded at the time when ``zmodload -Fa`` is
        run, an error message is printed and status 1 returned.
        
        ``zmodload -Fa`` can be used with the ``-l``, ``-L``, ``-e`` and
        ``-P`` options for listing and testing the existence of autoloadable
        features.  In this case ``-l`` is ignored if ``-L`` is specified.
        ``zmodload -FaL`` with no module name lists autoloads for all modules.
        
        Note that only standard features as described above can be autoloaded;
        other features require the module to be loaded before enabling.
        
    
    ``zmodload`` ``-d`` [ ``-L`` ] [ :var:`name` ]
    
    ``zmodload`` ``-d`` :var:`name` :var:`dep` ...
    
    ``zmodload`` ``-ud`` :var:`name` [ :var:`dep` ... ]
        
        The ``-d`` option can be used to specify module dependencies.  The modules
        named in the second and subsequent arguments will be loaded before the
        module named in the first argument.
        
        With ``-d`` and one argument, all dependencies for that module are listed.
        With ``-d`` and no arguments, all module dependencies are listed.  This
        listing is by default in a Makefile-like format.  The ``-L`` option
        changes this format to a list of ``zmodload -d`` commands.
        
        If ``-d`` and ``-u`` are both used, dependencies are removed.  If only one
        argument is given, all dependencies for that module are removed.
        
    
    ``zmodload`` ``-ab`` [ ``-L`` ]
    
    ``zmodload`` ``-ab`` [ ``-i`` ] :var:`name` [ :var:`builtin` ... ]
    
    ``zmodload`` ``-ub`` [ ``-i`` ] :var:`builtin` ...
        
        The ``-ab`` option defines autoloaded builtins.  It defines the specified
        :var:`builtin`\s.  When any of those builtins is called, the module specified
        in the first argument is loaded and all its features are enabled (for
        selective control of features use ``zmodload -F -a`` as described
        above).  If only the :var:`name` is given, one builtin is defined, with
        the same name as the module.  ``-i`` suppresses the error if the builtin
        is already defined or autoloaded, but not if another builtin of the
        same name is already defined.
        
        With ``-ab`` and no arguments, all autoloaded builtins are listed, with the
        module name (if different) shown in parentheses after the builtin name.
        The ``-L`` option changes this format to a list of ``zmodload -a``
        commands.
        
        If ``-b`` is used together with the ``-u`` option, it removes builtins
        previously defined with ``-ab``.  This is only possible if the builtin is
        not yet loaded.  ``-i`` suppresses the error if the builtin is already
        removed (or never existed).
        
        Autoload requests are retained if the module is subsequently unloaded
        until an explicit ``zmodload -ub`` :var:`builtin` is issued.
        
    
    ``zmodload`` ``-ac`` [ ``-IL`` ]
    
    ``zmodload`` ``-ac`` [ ``-iI`` ] :var:`name` [ :var:`cond` ... ]
    
    ``zmodload`` ``-uc`` [ ``-iI`` ] :var:`cond` ...
        
        The ``-ac`` option is used to define autoloaded condition codes. The
        :var:`cond` strings give the names of the conditions defined by the
        module. The optional ``-I`` option is used to define infix condition
        names. Without this option prefix condition names are defined.
        
        If given no condition names, all defined names are listed (as a series of
        ``zmodload`` commands if the ``-L`` option is given).
        
        The ``-uc`` option removes definitions for autoloaded conditions.
        
    
    ``zmodload`` ``-ap`` [ ``-L`` ]
    
    ``zmodload`` ``-ap`` [ ``-i`` ] :var:`name` [ :var:`parameter` ... ]
    
    ``zmodload`` ``-up`` [ ``-i`` ] :var:`parameter` ...
        
        The ``-p`` option is like the ``-b`` and ``-c`` options, but makes
        ``zmodload`` work on autoloaded parameters instead.
        
    
    ``zmodload`` ``-af`` [ ``-L`` ]
    
    ``zmodload`` ``-af`` [ ``-i`` ] :var:`name` [ :var:`function` ... ]
    
    ``zmodload`` ``-uf`` [ ``-i`` ] :var:`function` ...
        
        The ``-f`` option is like the ``-b``, ``-p``, and ``-c`` options, but
        makes ``zmodload`` work on autoloaded math functions instead. 
        
    
    ``zmodload`` ``-a`` [ ``-L`` ]
    
    ``zmodload`` ``-a`` [ ``-i`` ] :var:`name` [ :var:`builtin` ... ]
    
    ``zmodload`` ``-ua`` [ ``-i`` ] :var:`builtin` ...
        
        Equivalent to ``-ab`` and ``-ub``.
        
    
    ``zmodload -e`` [ ``-A`` ] [ :var:`string` ... ]
        
        The ``-e`` option without arguments lists all loaded modules; if the ``-A``
        option is also given, module aliases corresponding to loaded modules are
        also shown.  If arguments are provided, nothing is printed;
        the return status is set to zero if all :var:`string`\s given as arguments
        are names of loaded modules and to one if at least on :var:`string` is not
        the name of a loaded module.  This can be used to test for the
        availability of things implemented by modules.  In this case, any
        aliases are automatically resolved and the ``-A`` flag is not used.
        
    
    ``zmodload`` ``-A`` [ ``-L`` ] [ :var:`modalias`\[``=``:var:`module`] ... ]
        
        For each argument, if both :var:`modalias` and :var:`module` are given,
        define :var:`modalias` to be an alias for the module :var:`module`.
        If the module :var:`modalias` is ever subsequently requested, either via a
        call to ``zmodload`` or implicitly, the shell will attempt to load
        :var:`module` instead.  If :var:`module` is not given, show the definition of
        :var:`modalias`.  If no arguments are given, list all defined module aliases.
        When listing, if the ``-L`` flag was also given, list the definition as a
        ``zmodload`` command to recreate the alias.
        
        The existence of aliases for modules is completely independent of whether
        the name resolved is actually loaded as a module: while the alias exists,
        loading and unloading the module under any alias has exactly the same
        effect as using the resolved name, and does not affect the connection
        between the alias and the resolved name which can be removed either by
        ``zmodload -R`` or by redefining the alias.  Chains of aliases (i.e. where
        the first resolved name is itself an alias) are valid so long as these are
        not circular.  As the aliases take the same format as module names, they
        may include path separators:  in this case, there is no requirement for any
        part of the path named to exist as the alias will be resolved first.  For
        example, ``any/old/alias`` is always a valid alias.
        
        Dependencies added to aliased modules are actually added to the resolved
        module; these remain if the alias is removed.  It is valid to create an
        alias whose name is one of the standard shell modules and which resolves to
        a different module.  However, if a module has dependencies, it
        will not be possible to use the module name as an alias as the module will
        already be marked as a loadable module in its own right.
        
        Apart from the above, aliases can be used in the ``zmodload`` command
        anywhere module names are required.  However, aliases will not be
        shown in lists of loaded modules with a bare ``zmodload``.
        
    
    ``zmodload`` ``-R`` :var:`modalias` ...
        
        For each :var:`modalias` argument that was previously defined as a module
        alias via ``zmodload -A``, delete the alias.  If any was not defined, an
        error is caused and the remainder of the line is ignored.
        
    
    
    
    Note that ``zsh`` makes no distinction between modules that were linked 
    into the shell and modules that are loaded dynamically. In both cases
    this builtin command has to be used to make available the builtins and
    other things defined by modules (unless the module is autoloaded on
    these definitions). This is true even for systems that don't support
    dynamic loading of modules.
    

``zparseopts``
    
    See :ref:`The zsh/zutil Module`.
    

``zprof``
    
    See :ref:`The zsh/zprof Module`.
    

``zpty``
    
    See :ref:`The zsh/zpty Module`.
    

``zregexparse``
    
    See :ref:`The zsh/zutil Module`.
    

``zsocket``
    
    See :ref:`The zsh/net/socket Module`.
    

``zstyle``
    
    See :ref:`The zsh/zutil Module`.
    

``ztcp``
    
    See :ref:`The zsh/net/tcp Module`.
    

.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "ZSHBUILTINS" "1" "Jul 31, 2026" "5.9.999.3" "Zsh"
.SH NAME
zshbuiltins \- zsh built-in commands
.SH SHELL BUILTIN COMMANDS
.sp
Some shell builtin commands take options as described in individual
entries; these are often referred to in the list below as \fBflags\fP to
avoid confusion with shell options, which may also have an effect on the
behaviour of builtin commands.  In this introductory section,
\fBoption\fP always has the meaning of an option to a command that should
be familiar to most command line users.
.sp
Typically, options are single letters preceded by a hyphen (\fB\-\fP).
Options that take an argument accept it either immediately following the
option letter or after white space, for example \fBprint \-C3 {1..9}\fP or
\fBprint \-C 3 {1..9}\fP are equivalent.  Arguments to options are not the
same as arguments to the command; the documentation indicates which is
which.  Options that do not take an argument may be combined in a single
word, for example \fBprint \-rca \-\- *\fP and \fBprint \-r \-c \-a \-\- *\fP are
equivalent.
.sp
Some shell builtin commands also take options that begin with \fB+\fP
instead of \fB\-\fP\&.  The list below makes clear which commands these
are.
.sp
Options (together with their individual arguments, if any) must appear
in a group before any non\-option arguments; once the first non\-option
argument has been found, option processing is terminated.
.sp
All builtin commands other than \fBecho\fP and precommand modifiers,
even those that have no options, can be given the argument \fB\-\fP\fB\-\fP
to terminate option processing.  This indicates that the following words
are non\-option arguments, but is otherwise ignored.  This is useful in
cases where arguments to the command may begin with \fB\-\fP\&.  For
historical reasons, most builtin commands (including \fBecho\fP) also
recognize a single \fB\-\fP in a separate word for this purpose; note
that this is less standard and use of \fB\-\fP\fB\-\fP is recommended.
.sp
\fB\-\fP \fIsimple command\fP
.INDENT 0.0
.INDENT 3.5
See Precommand Modifiers\&.
.UNINDENT
.UNINDENT
.sp
\fB\&.\fP \fIfile\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Read commands from \fIfile\fP and execute them in the current shell
environment.
.sp
If \fIfile\fP does not contain a slash, or if \fBPATH_DIRS\fP is set,
the shell looks in the components of \fB$path\fP to find the directory
containing \fIfile\fP\&.  Files in the current directory are not read
unless \fB\&.\fP appears somewhere in \fB$path\fP\&.  If a file named
\fIfile\fP\fB\&.zwc\fP is found, is newer than \fIfile\fP, and is the
compiled form (created with the \fBzcompile\fP builtin) of \fIfile\fP,
then commands are read from that file instead of \fIfile\fP\&.
.sp
If any arguments \fIarg\fP are given,
they become the positional parameters; the old positional
parameters are restored when the \fIfile\fP is done executing.
However, if no arguments are given,
the positional parameters remain those of the calling context,
and no restoring is done.
.sp
If \fIfile\fP was not found the return status is 127; if \fIfile\fP was found
but contained a syntax error the return status is 126; else the return
status is the exit status of the last command executed.
.UNINDENT
.UNINDENT
.sp
\fB:\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
This command does nothing, although normal argument expansions is performed
which may have effects on shell parameters.  A zero exit status is returned.
.UNINDENT
.UNINDENT
.sp
\fBalias\fP [ {\fB+|\-}gmrsL\fP ] [ \fIname\fP[\fB=\fP\fIvalue\fP] ... ]
.INDENT 0.0
.INDENT 3.5
For each \fIname\fP with a corresponding \fIvalue\fP, define an alias
with that value.  A trailing space in \fIvalue\fP causes the next word
to be checked for alias expansion.  If the \fB\-g\fP flag is present,
define a global alias; global aliases are expanded even if they do not
occur in command position:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 % perldoc \-\-help 2>&1 | grep \(aqbuilt\-in functions\(aq
     \-f   Search Perl built\-in functions
 % alias \-g HG=\(aq\-\-help 2>&1 | grep\(aq
 % perldoc HG \(aqbuilt\-in functions\(aq
     \-f   Search Perl built\-in functions
.EE
.UNINDENT
.UNINDENT
.sp
If the \fB\-s\fP flag is present, define a suffix alias: if the command
word on a command line is in the form \fItext\fP\fB\&.\fP\fIname\fP, where
\fItext\fP is any non\-empty string, it is replaced by the text
\fIvalue\fP \fItext\fP\fB\&.\fP\fIname\fP\&.  Note that \fIname\fP is treated as
a literal string, not a pattern.  A trailing space in \fIvalue\fP is not
special in this case.  For example,
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 alias \-s ps=\(aqgv \-\-\(aq
.EE
.UNINDENT
.UNINDENT
.sp
will cause the command \fB*.ps\fP to be expanded to \fBgv \-\- *.ps\fP\&.  As
alias expansion is carried out earlier than globbing, the \fB*.ps\fP will
then be expanded.  Suffix aliases constitute a different name space from
other aliases (so in the above example it is still possible
to create an alias for the command \fBps\fP) and the two sets are never
listed together.
.sp
For each \fIname\fP with no \fIvalue\fP,
print the value of \fIname\fP, if any.  With no arguments, print all
currently defined aliases other than suffix aliases.  If the \fB\-m\fP flag
is given the arguments are taken as patterns (they should be quoted to
preserve them from being interpreted as glob patterns), and the aliases
matching these patterns are printed.  When printing aliases and one of
the \fB\-g\fP, \fB\-r\fP or \fB\-s\fP flags is present, restrict the printing to
global, regular or suffix aliases, respectively; a regular alias is one
which is neither a global nor a suffix alias.   Using \fB+\fP
instead of \fB\-\fP, or ending the option list with a single
\fB+\fP, prevents the values of the aliases from being printed.
.sp
If the \fB\-L\fP flag is present, then print each
alias in a manner suitable for putting in a startup script.  The exit
status is nonzero if a \fIname\fP (with no \fIvalue\fP) is given for
which no alias has been defined.
.sp
For more on aliases, including common problems,
see Aliasing\&.
.UNINDENT
.UNINDENT
.sp
\fBautoload\fP [ {\fB+|\-}RTUXdkmrtWz\fP ] [ \fB\-w\fP ] [ \fIname\fP ... ]
.INDENT 0.0
.INDENT 3.5
See Autoloading Functions
for full details.  The \fBfpath\fP parameter
will be searched to find the function definition when the function is
first referenced.
.sp
If \fIname\fP 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 option \fB\-d\fP is given, searching
for the function defaults to \fB$fpath\fP\&.  If a function is loaded by
absolute path, any functions loaded from it that are marked for
\fBautoload\fP without an absolute path have the load path of the parent
function temporarily prepended to \fB$fpath\fP\&.
.sp
If the option \fB\-r\fP or \fB\-R\fP is given, the function is searched for
immediately and the location is recorded internally for use when the
function is executed; a relative path is expanded using the value of
\fB$PWD\fP\&.  This protects against a change to \fB$fpath\fP after the call
to \fBautoload\fP\&.  With \fB\-r\fP, if the function is not found, it is
silently left unresolved until execution; with \fB\-R\fP, an error message
is printed and command processing aborted immediately the search fails,
i.e. at the \fBautoload\fP command rather than at function execution..
.sp
The flag \fB\-X\fP may be used only inside a shell function.  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.  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 \fB\-d\fP option to allow the function search to default to \fB$fpath\fP
if it is not in the given location.
.sp
The flag \fB+X\fP attempts to load each \fIname\fP as an autoloaded function,
but does \fInot\fP execute it.  The exit status is zero (success) if the
function was not previously defined \fIand\fP a definition for it was found.
This does \fInot\fP 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.  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 behaviour on the first call to the function.
If the \fB\-m\fP flag is also given each \fIname\fP is treated as a
pattern and all functions already marked for autoload that match the
pattern are loaded.
.sp
With the \fB\-t\fP flag, turn on execution tracing; with \fB\-T\fP, turn on
execution tracing only for the current function, turning it off on entry
to any called functions that do not also have tracing enabled.
.sp
With the \fB\-U\fP flag, alias expansion is suppressed when the function is
loaded.
.sp
With the \fB\-w\fP flag, the \fIname\fPs are taken as names of files compiled
with the \fBzcompile\fP builtin, and all functions defined in them are
marked for autoloading.
.sp
The flags \fB\-z\fP and \fB\-k\fP mark the function to be autoloaded using the
zsh or ksh style, as if the option \fBKSH_AUTOLOAD\fP were unset or were
set, respectively.  The flags override the setting of the option at the
time the function is loaded.
.sp
Note that the \fBautoload\fP 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 \fBemulate\fP command can be used:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 emulate zsh \-c \(aqautoload \-Uz \fIfunc\fP\(aq
.EE
.UNINDENT
.UNINDENT
.sp
arranges that when \fIfunc\fP is loaded the shell is in native \fBzsh\fP
emulation, and this emulation is also applied when \fIfunc\fP is run.
.sp
Some of the functions of \fBautoload\fP are also provided by \fBfunctions
\-u \(ga\(gaor\fP functions \-U\(ga\(ga, but\(ga\(ga autoload\(ga\(ga is a more comprehensive
interface.
.UNINDENT
.UNINDENT
.sp
\fBbg\fP [ \fIjob\fP ... ]
.sp
\fIjob\fP ... \fB&\fP
.INDENT 0.0
.INDENT 3.5
Put each specified \fIjob\fP in the background,
or the current job if none is specified.
.UNINDENT
.UNINDENT
.sp
\fBbindkey\fP
.INDENT 0.0
.INDENT 3.5
See Zle Builtins\&.
.UNINDENT
.UNINDENT
.sp
\fBbreak\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Exit from an enclosing \fBfor\fP, \fBwhile\fP,
\fBuntil\fP, \fBselect\fP or \fBrepeat\fP loop. If an arithmetic expression \fIn\fP
is specified, then break \fIn\fP levels instead of just one.
.UNINDENT
.UNINDENT
.sp
\fBbuiltin\fP \fIname\fP [ \fIargs\fP ... ]
.INDENT 0.0
.INDENT 3.5
Executes the builtin \fIname\fP, with the given \fIargs\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBbye\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBexit\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBcap\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/cap Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcd\fP [ \fB\-qsLP\fP ] [ \fIarg\fP ]
.sp
\fBcd\fP [ \fB\-qsLP\fP ] \fIold\fP \fInew\fP
.sp
\fBcd\fP [ \fB\-qsLP\fP ] {\fB+|\-\fP}:var:\fIn\fP
.INDENT 0.0
.INDENT 3.5
Change the current directory.  In the first form, change the
current directory to \fIarg\fP, or to the value of \fB$HOME\fP if
\fIarg\fP is not specified.  If \fIarg\fP is \fB\-\fP, change to the
previous directory.
.sp
Otherwise, if \fIarg\fP begins with a slash, attempt to change to the
directory given by \fIarg\fP\&.
.sp
If \fIarg\fP does not begin with a slash, the behaviour depends on whether
the current directory \fB\&.\fP occurs in the list of directories contained
in the shell parameter \fBcdpath\fP\&.  If it does not, first attempt to change
to the directory \fIarg\fP under the current directory, and if that fails
but \fBcdpath\fP is set and contains at least one element attempt to change
to the directory \fIarg\fP under each component of \fBcdpath\fP in turn until
successful.  If \fB\&.\fP occurs in \fBcdpath\fP, then \fBcdpath\fP is searched
strictly in order so that \fB\&.\fP is only tried at the appropriate point.
.sp
The order of testing \fBcdpath\fP is modified if the option \fBPOSIX_CD\fP
is set, as described in the documentation for the option.
.sp
If no directory is found, the option \fBCDABLE_VARS\fP is set, and a
parameter named \fIarg\fP exists whose value begins with a slash, treat its
value as the directory.  In that case, the parameter is added to the named
directory hash table.
.sp
The second form of \fBcd\fP substitutes the string \fInew\fP
for the string \fIold\fP in the name of the current directory,
and tries to change to this new directory.
.sp
The third form of \fBcd\fP extracts an entry from the directory
stack, and changes to that directory.  An argument of the form
\fB+\fP\fIn\fP identifies a stack entry by counting from the left
of the list shown by the \fBdirs\fP command, starting with zero.
An argument of the form \fB\-\fP\fIn\fP counts from the right.
If the \fBPUSHD_MINUS\fP option is set, the meanings of \fB+\fP
and \fB\-\fP in this context are swapped.
If the \fBPOSIX_CD\fP option is set, this form of \fBcd\fP is not recognised
and will be interpreted as the first form.
.sp
If the \fB\-q\fP (quiet) option is specified, the hook function \fBchpwd\fP
and the functions in the array \fBchpwd_functions\fP are not called.
This is useful for calls to \fBcd\fP that do not change the environment
seen by an interactive user.
.sp
If the \fB\-s\fP option is specified, \fBcd\fP refuses to change the current
directory if the given pathname contains symlinks.  If the \fB\-P\fP option
is given or the \fBCHASE_LINKS\fP option is set, symbolic links are resolved
to their true values.  If the \fB\-L\fP option is given symbolic links are
retained in the directory (and not resolved) regardless of the state of
the \fBCHASE_LINKS\fP option.
.UNINDENT
.UNINDENT
.sp
\fBchdir\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBcd\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBclone\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/clone Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcommand\fP [ \fB\-pvV\fP ] \fIsimple command\fP
.INDENT 0.0
.INDENT 3.5
The simple command argument is taken as an external command instead of
a function or builtin and is executed. If the \fBPOSIX_BUILTINS\fP option
is set, builtins will also be executed but certain special properties
of them are suppressed. The \fB\-p\fP flag causes a default path to be
searched instead of that in \fB$path\fP\&. With the \fB\-v\fP flag, \fBcommand\fP
is similar to \fBwhence\fP and with \fB\-V\fP, it is equivalent to \fBwhence
\-v\fP\&.
.sp
See also Precommand Modifiers\&.
.UNINDENT
.UNINDENT
.sp
\fBcomparguments\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcompcall\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/compctl Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcompctl\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/compctl Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcompdescribe\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcompfiles\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcompgroups\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcompquote\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcomptags\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcomptry\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcompvalues\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/computil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBcontinue\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Resume the next iteration of the enclosing
\fBfor\fP, \fBwhile\fP, \fBuntil\fP, \fBselect\fP or
\fBrepeat\fP loop. If an arithmetic expression \fIn\fP is specified, break out of
\fIn\fP\-1 loops and resume at the \fIn\fPth enclosing loop.
.UNINDENT
.UNINDENT
.sp
\fBdeclare\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBtypeset\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBdirs\fP [ \fB\-c\fP ] [ \fIarg\fP ... ]
.sp
\fBdirs\fP [ \fB\-lpv\fP ]
.INDENT 0.0
.INDENT 3.5
With no arguments, print the contents of the directory stack.
Directories are added to this stack with the \fBpushd\fP command,
and removed with the \fBcd\fP or \fBpopd\fP commands.
If arguments are specified, load them onto the directory stack,
replacing anything that was there, and push the current directory
onto the stack.
.sp
\fB\-c\fP
.INDENT 0.0
.INDENT 3.5
clear the directory stack.
.UNINDENT
.UNINDENT
.sp
\fB\-l\fP
.INDENT 0.0
.INDENT 3.5
print directory names in full instead of using \fB~\fP expressions
(see Filename Expansion).
.UNINDENT
.UNINDENT
.sp
\fB\-p\fP
.INDENT 0.0
.INDENT 3.5
print directory entries one per line.
.UNINDENT
.UNINDENT
.sp
\fB\-v\fP
.INDENT 0.0
.INDENT 3.5
number the directories in the stack when printing.
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
\fBdisable\fP [ \fB\-afmprs\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Temporarily disable the \fIname\fPd hash table elements or patterns.  The default
is to disable builtin commands.  This allows you to use an external
command with the same name as a builtin command.  The \fB\-a\fP option
causes \fBdisable\fP to act on regular or global aliases.  The \fB\-s\fP
option causes \fBdisable\fP to act on suffix aliases.  The \fB\-f\fP option causes
\fBdisable\fP to act on shell functions.  The \fB\-r\fP options causes
\fBdisable\fP to act on reserved words.  Without arguments all disabled
hash table elements from the corresponding hash table are printed.
With the \fB\-m\fP flag the arguments are taken as patterns (which should be
quoted to prevent them from undergoing filename expansion), and all hash
table elements from the corresponding hash table matching these patterns
are disabled.  Disabled objects can be enabled with the \fBenable\fP
command.
.sp
With the option \fB\-p\fP, \fIname\fP ... refer to elements of the
shell\(aqs pattern syntax as described in Filename Generation\&.
Certain elements can be disabled separately, as given below.
.sp
Note that patterns
not allowed by the current settings for the options \fBEXTENDED_GLOB\fP,
\fBKSH_GLOB\fP and \fBSH_GLOB\fP are never enabled, regardless of the
setting here.  For example, if \fBEXTENDED_GLOB\fP is not active,
the pattern \fB^\fP is ineffective even if \fBdisable \-p \(dq^\(dq\fP has
not been issued.  The list below indicates any option settings
that restrict the use of the pattern.  It should be noted that
setting \fBSH_GLOB\fP has a wider effect than merely disabling patterns
as certain expressions, in particular those involving parentheses,
are parsed differently.
.sp
The following patterns may be disabled; all
the strings need quoting on the command line to prevent them from
being interpreted immediately as patterns and the patterns are
shown below in single quotes as a reminder.
.sp
\fB\(aq?\(aq\fP
.INDENT 0.0
.INDENT 3.5
The pattern character \fB?\fP wherever it occurs, including when preceding
a parenthesis with \fBKSH_GLOB\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\(aq*\(aq\fP
.INDENT 0.0
.INDENT 3.5
The pattern character \fB*\fP wherever it occurs, including recursive
globbing and when preceding a parenthesis with \fBKSH_GLOB\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\(aq[\(aq\fP
.INDENT 0.0
.INDENT 3.5
Character classes.
.UNINDENT
.UNINDENT
.sp
\fB\(aq<\(aq\fP (\fBNO_SH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
Numeric ranges.
.UNINDENT
.UNINDENT
.sp
\fB\(aq|\(aq\fP (\fBNO_SH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
Alternation in grouped patterns, case statements, or KSH_GLOB
parenthesised expressions.
.UNINDENT
.UNINDENT
.sp
\fB\(aq(\(aq\fP (\fBNO_SH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
Grouping using single parentheses.  Disabling this does not disable the
use of parentheses for \fBKSH_GLOB\fP where they are introduced by a
special character, nor for glob qualifiers (use \fBsetopt
NO_BARE_GLOB_QUAL\fP to disable glob qualifiers that use parentheses
only).
.UNINDENT
.UNINDENT
.sp
\fB\(aq~\(aq\fP (\fBEXTENDED_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
Exclusion in the form \fIA\fP\fB~\fP\fIB\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\(aq^\(aq\fP (\fBEXTENDED_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
Exclusion in the form \fIA\fP\fB^\fP\fIB\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\(aq#\(aq\fP (\fBEXTENDED_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
The pattern character \fB#\fP wherever it occurs, both for
repetition of a previous pattern and for indicating globbing flags.
.UNINDENT
.UNINDENT
.sp
\fB\(aq?(\(aq\fP (\fBKSH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
The grouping form \fB?(\fP\fI\&...\fP\fB)\fP\&.  Note this is also
disabled if \fB\(aq?\(aq\fP is disabled.
.UNINDENT
.UNINDENT
.sp
\fB\(aq*(\(aq\fP (\fBKSH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
The grouping form \fB*(\fP\fI\&...\fP\fB)\fP\&.  Note this is also
disabled if \fB\(aq*\(aq\fP is disabled.
.UNINDENT
.UNINDENT
.sp
\fB\(aq+(\(aq\fP (\fBKSH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
The grouping form \fB+(\fP\fI\&...\fP\fB)\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\(aq!(\(aq\fP (\fBKSH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
The grouping form \fB!(\fP\fI\&...\fP\fB)\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\(aq@(\(aq\fP (\fBKSH_GLOB\fP)
.INDENT 0.0
.INDENT 3.5
The grouping form \fB@(\fP\fI\&...\fP\fB)\fP\&.
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
\fBdisown\fP [ \fB\-a\fP | \fIjob\fP ... ]
.sp
\fIjob\fP ... \fB&|\fP
.sp
\fIjob\fP ... \fB&!\fP
.INDENT 0.0
.INDENT 3.5
Remove the specified \fIjob\fPs from the job table; the shell will
no longer report their status, and will not complain if you
try to exit an interactive shell with them running or stopped.
If no \fIjob\fP is specified, disown the current job.
With \fB\-a\fP, disown all jobs.
.sp
If the \fIjob\fPs are currently stopped and the \fBAUTO_CONTINUE\fP option
is not set, a warning is printed containing information about how to
make them running after they have been disowned.  If one of the latter
two forms is used, the \fIjob\fPs will automatically be made running,
independent of the setting of the \fBAUTO_CONTINUE\fP option.
.UNINDENT
.UNINDENT
.sp
\fBecho\fP [ \fB\-neE\fP ] [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Write each \fIarg\fP on the standard output, with a space separating
each one.
If the \fB\-n\fP flag is not present, print a newline at the end.
\fBecho\fP recognizes the following escape sequences:
.INDENT 0.0
.TP
.B \fB\ea\fP
bell character
.TP
.B \fB\eb\fP
backspace
.TP
.B \fB\ec\fP
suppress subsequent characters and final newline
.TP
.B \fB\ee\fP
escape
.TP
.B \fB\ef\fP
form feed
.TP
.B \fB\en\fP
linefeed (newline)
.TP
.B \fB\er\fP
carriage return
.TP
.B \fB\et\fP
horizontal tab
.TP
.B \fB\ev\fP
vertical tab
.TP
.B \fB\e\e\fP
backslash
.TP
.B \fB\e0\fP\fINNN\fP
character code in octal
.TP
.B \fB\ex\fP\fINN\fP
character code in hexadecimal
.TP
.B \fB\eu\fP\fINNNN\fP
unicode character code in hexadecimal
.TP
.B \fB\eU\fP\fINNNNNNNN\fP
unicode character code in hexadecimal
.UNINDENT
.sp
The \fB\-E\fP flag, or the \fBBSD_ECHO\fP option, can be used to disable
these escape sequences.  In the latter case, \fB\-e\fP flag can be used to
enable them.
.sp
Note that for standards compliance a double dash does not terminate
option processing; instead, it is printed directly.  However, a
single dash does terminate option processing, so the first dash,
possibly following options, is not printed, but everything following it
is printed as an argument.  The single dash behaviour is different
from other shells.  For a more portable way of printing text, see
\fBprintf\fP, and for a more controllable way of printing text within zsh,
see \fBprint\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBechotc\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/termcap Module\&.
.UNINDENT
.UNINDENT
.sp
\fBechoti\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/terminfo Module\&.
.UNINDENT
.UNINDENT
.sp
\fBemulate\fP [ \fB\-lLR\fP ] [ {\fBzsh|sh|ksh|csh\fP} [ \fIflags\fP ... ] ]
.INDENT 0.0
.INDENT 3.5
Without any argument print current emulation mode.
.sp
With single argument set up zsh options to emulate the specified shell
as much as possible.
\fBcsh\fP will never be fully emulated.
If the argument is not one of the shells listed above, \fBzsh\fP
will be used as a default; more precisely, the tests performed on the
argument are the same as those used to determine the emulation at startup
based on the shell name, see Compatibility\&.
In addition to setting shell options, the command also restores
the pristine state of pattern enables, as if all patterns had been
enabled using \fBenable \-p\fP\&.
.sp
If the \fBemulate\fP command occurs inside a function that has been
marked for execution tracing with \fBfunctions \-t\fP then the \fBxtrace\fP
option will be turned on regardless of emulation mode or other options.
Note that code executed inside the function by the \fB\&.\fP, \fBsource\fP, or
\fBeval\fP commands is not considered to be running directly from the
function, hence does not provoke this behaviour.
.sp
If the \fB\-R\fP switch is given, all settable options
are reset to their default value corresponding to the specified emulation
mode, except for certain options describing the interactive
environment; otherwise, only those options likely to cause portability
problems in scripts and functions are altered.  If the \fB\-L\fP switch is given,
the options \fBLOCAL_OPTIONS\fP, \fBLOCAL_PATTERNS\fP and \fBLOCAL_TRAPS\fP
will be set as
well, causing the effects of the \fBemulate\fP command and any \fBsetopt\fP,
\fBdisable \-p\fP or \fBenable \-p\fP, and \fBtrap\fP commands to be local to
the immediately surrounding shell
function, if any; normally these options are turned off in all emulation
modes except \fBksh\fP\&. The \fB\-L\fP switch is mutually exclusive with the
use of \fB\-c\fP in \fIflags\fP\&.
.sp
If there is a single argument and the \fB\-l\fP switch is given, the
options that would be set or unset (the latter indicated with the prefix
\fBno\fP) are listed.  \fB\-l\fP can be combined with \fB\-L\fP or \fB\-R\fP and
the list will be modified in the appropriate way.  Note the list does
not depend on the current setting of options, i.e. it includes all
options that may in principle change, not just those that would actually
change.
.sp
The \fIflags\fP may be any of the invocation\-time flags described in
Invocation,
except that \fB\-o EMACS\fP and \fB\-o VI\fP may not be used.
.sp
If \fB\-c\fP \fIarg\fP appears in \fIflags\fP, \fIarg\fP is evaluated while the
requested emulation is temporarily in effect.  In this case the emulation
mode and all options are restored to their previous values before
\fBemulate\fP returns.  The \fB\-R\fP switch may precede the name of the shell
to emulate; note this has a meaning distinct from including \fB\-R\fP in
\fIflags\fP\&.
.sp
Use of \fB\-c\fP enables \(gasticky\(aq emulation mode for functions defined
within the evaluated expression:  the emulation mode is associated
thereafter with the function so that whenever the function is executed
the emulation (respecting the \fB\-R\fP switch, if present) and all
options are set (and pattern disables cleared)
before entry to the function, and the state is restored after exit.
If the function is called when the sticky emulation is already in
effect, either within an \fBemulate\fP \fIshell\fP \fB\-c\fP expression or
within another function with the same sticky emulation, entry and exit
from the function do not cause options to be altered (except due to
standard processing such as the \fBLOCAL_OPTIONS\fP option).  This also
applies to functions marked for autoload within the sticky emulation;
the appropriate set of options will be applied at the point the
function is loaded as well as when it is run.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 emulate sh \-c \(aqfni() { setopt cshnullglob; }
 fno() { fni; }\(aq
 fno
.EE
.UNINDENT
.UNINDENT
.sp
The two functions \fBfni\fP and \fBfno\fP are defined with sticky \fBsh\fP
emulation.  \fBfno\fP is then executed, causing options associated
with emulations to be set to their values in \fBsh\fP\&.  \fBfno\fP then
calls \fBfni\fP; because \fBfni\fP is also marked for sticky \fBsh\fP
emulation, no option changes take place on entry to or exit from it.
Hence the option \fBcshnullglob\fP, turned off by \fBsh\fP emulation, will
be turned on within \fBfni\fP and remain on return to \fBfno\fP\&.  On exit
from \fBfno\fP, the emulation mode and all options will be restored to the
state they were in before entry to the temporary emulation.
.sp
The documentation above is typically sufficient for the intended
purpose of executing code designed for other shells in a suitable
environment.  More detailed rules follow.
.INDENT 0.0
.IP 1. 3
The sticky emulation environment provided by \fBemulate\fP
\fIshell\fP \fB\-c\fP is identical to that provided by entry to
a function marked for sticky emulation as a consequence of being
defined in such an environment.  Hence, for example, the sticky
emulation is inherited by subfunctions defined within functions
with sticky emulation.
.IP 2. 3
No change of options takes place on entry to or exit from
functions that are not marked for sticky emulation, other than those
that would normally take place, even if those functions are called
within sticky emulation.
.IP 3. 3
No special handling is provided for functions marked for
\fBautoload\fP nor for functions present in wordcode created by
the \fBzcompile\fP command.
.IP 4. 3
The presence or absence of the \fB\-R\fP switch to \fBemulate\fP
corresponds to different sticky emulation modes, so for example
\fBemulate sh \-c\fP, \fBemulate \-R sh \-c\fP and \fBemulate csh \-c\fP
are treated as three distinct sticky emulations.
.IP 5. 3
Difference in shell options supplied in addition to the
basic emulation also mean the sticky emulations are different, so for
example \fBemulate zsh \-c\fP and \fBemulate zsh \-o cbases \-c\fP are
treated as distinct sticky emulations.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
\fBenable\fP [ \fB\-afmprs\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Enable the \fIname\fPd hash table elements, presumably disabled
earlier with \fBdisable\fP\&.  The default is to enable builtin commands.
The \fB\-a\fP option causes \fBenable\fP to act on regular or global aliases.
The \fB\-s\fP option causes \fBenable\fP to act on suffix aliases.
The \fB\-f\fP option causes \fBenable\fP to act on shell functions.  The \fB\-r\fP
option causes \fBenable\fP to act on reserved words.  Without arguments
all enabled hash table elements from the corresponding hash table are
printed.  With the \fB\-m\fP flag the arguments are taken as patterns
(should be quoted) and all hash table elements from the corresponding
hash table matching these patterns are enabled.  Enabled objects can be
disabled with the \fBdisable\fP builtin command.
.sp
\fBenable \-p\fP reenables patterns disabled with \fBdisable \-p\fP\&.  Note
that it does not override globbing options; for example, \fBenable \-p
\(dq~\(dq \(ga\(gadoes not cause the pattern character\fP ~\(ga\(ga to be active unless
the \fBEXTENDED_GLOB\fP option is also set.  To enable all possible
patterns (so that they may be individually disabled with \fBdisable \-p\fP),
use \fBsetopt EXTENDED_GLOB KSH_GLOB NO_SH_GLOB\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBeval\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Read the arguments as input to the shell and execute the resulting
command(s) in the current shell process.  The return status is
the same as if the commands had been executed directly by the shell;
if there are no \fIargs\fP or they contain no commands (i.e. are
an empty string or whitespace) the return status is zero.
.UNINDENT
.UNINDENT
.sp
\fBexec\fP [ \fB\-cl\fP ] [ \fB\-a\fP \fIargv0\fP ] [ \fIcommand\fP [ \fIarg\fP ... ] ]
.INDENT 0.0
.INDENT 3.5
Replace the current shell with \fIcommand\fP rather than forking.
If \fIcommand\fP is a shell builtin command or a shell function,
the shell executes it, and exits when the command is complete.
.sp
With \fB\-c\fP clear the environment; with \fB\-l\fP prepend \fB\-\fP to the
\fBargv[0]\fP string of the command executed (to simulate a login shell);
with \fB\-a\fP \fIargv0\fP set the \fBargv[0]\fP string of the command
executed.
See Precommand Modifiers\&.
.sp
If the option \fBPOSIX_BUILTINS\fP is set, \fIcommand\fP is never
interpreted as a shell builtin command or shell function.  This
means further precommand modifiers such as \fBbuiltin\fP and
\fBnoglob\fP are also not interpreted within the shell.  Hence
\fIcommand\fP is always found by searching the command path.
.sp
If \fIcommand\fP is omitted but any redirections are specified,
then the redirections will take effect in the current shell.
.UNINDENT
.UNINDENT
.sp
\fBexit\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Exit the shell with the exit status specified by an arithmetic
expression \fIn\fP; if none
is specified, use the exit status from the last command executed.
\&.. index:: single: IGNORE_EOF, use of; Program
.sp
An EOF condition will also cause the shell to exit, unless
the \fBIGNORE_EOF\fP option is set.
.sp
See notes at the end of Signals
for some possibly unexpected interactions
of the \fBexit\fP command with jobs.
.UNINDENT
.UNINDENT
.sp
\fBexport\fP [ \fIname\fP[\fB=\fP\fIvalue\fP] ... ]
.INDENT 0.0
.INDENT 3.5
The specified \fIname\fPs are marked for automatic export
to the environment of subsequently executed commands.
Equivalent to \fBtypeset \-gx\fP\&.
If a parameter specified does not
already exist, it is created in the global scope.
.UNINDENT
.UNINDENT
.sp
\fBfalse\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Do nothing and return an exit status of 1.
.UNINDENT
.UNINDENT
.sp
\fBfc\fP [ \fB\-e\fP \fIename\fP ] [ \fB\-s\fP ] [ \fB\-LI\fP ] [ \fB\-m\fP \fImatch\fP ] [ \fIold\fP\fB=\fP\fInew\fP ... ] [ \fIfirst\fP [ \fIlast\fP ] ]
.sp
\fBfc \-l\fP [ \fB\-LI\fP ] [ \fB\-nrdfEiD\fP ] [ \fB\-t\fP \fItimefmt\fP ] [ \fB\-m\fP \fImatch\fP ]
.INDENT 0.0
.INDENT 3.5
[ \fIold\fP\fB=\fP\fInew\fP ... ] [ \fIfirst\fP [ \fIlast\fP ] ]
.UNINDENT
.UNINDENT
.sp
\fBfc \-p\fP [ \fB\-a\fP ] [ \fIfilename\fP [ \fIhistsize\fP [ \fIsavehistsize\fP ] ] ]
.sp
\fBfc\fP \fB\-P\fP
.sp
\fBfc\fP \fB\-ARWI\fP [ \fIfilename\fP ]
.INDENT 0.0
.INDENT 3.5
The \fBfc\fP command controls the interactive history mechanism.  Note
that reading and writing of history options is only performed if the
shell is interactive.  Usually this is detected automatically, but
it can be forced by setting the \fBinteractive\fP option when starting the
shell.
.sp
The first two forms of this command select a range of events from
\fIfirst\fP to \fIlast\fP from the history list.  The arguments \fIfirst\fP
and \fIlast\fP may be specified as a number or as a string.  A negative
number is used as an offset to the current history event number.  A string
specifies the most recent event beginning with the given string.  All
substitutions \fIold\fP\fB=\fP\fInew\fP, if any, are then performed on the
text of the events.
.sp
The range of events selected by numbers can be narrowed further by the
following flags.
.INDENT 0.0
.TP
.B \fB\-I\fP
restricts to only internal events (not from \fB$HISTFILE\fP)
.TP
.B \fB\-L\fP
restricts to only local events (not from other shells, see
\fBSHARE_HISTORY\fP in
\fBzshoptions\fP \-\- note that \fB$HISTFILE\fP is
considered local when read at startup)
.TP
.B \fB\-m\fP
takes the first argument as a pattern (which should be
quoted) and only the history events matching this pattern are considered
.UNINDENT
.sp
If \fIfirst\fP is not specified, it will be set to \-1 (the most recent
event), or to \-16 if the \fB\-l\fP flag is given.
If \fIlast\fP is not specified, it will be set to \fIfirst\fP,
or to \-1 if the \fB\-l\fP flag is given.
However, if the current event has added entries to the history with
\fBprint \-s\fP or \fBfc \-R\fP, then the default \fIlast\fP for \fB\-l\fP
includes all new history entries since the current event began.
.sp
When the \fB\-l\fP flag is given, the resulting events are listed on
standard output.  Otherwise the editor program specified by \fB\-e\fP \fIename\fP
is invoked on a file containing these history events.  If \fB\-e\fP is not given, the
value of the parameter \fBFCEDIT\fP is used; if that is not set the value of
the parameter \fBEDITOR\fP is used; if that is not set a builtin default,
usually \fBvi\fP is used.  If \fIename\fP is \fB\-\fP, no editor is invoked.
When editing is complete, the edited command is executed.
.sp
The flag \fB\-s\fP is equivalent to \fB\-e \-\fP\&.
The flag \fB\-r\fP reverses the order of the events and the
flag \fB\-n\fP suppresses event numbers when listing.
.sp
Also when listing,
.INDENT 0.0
.TP
.B \fB\-d\fP
prints timestamps for each event
.TP
.B \fB\-f\fP
prints full time\-date stamps in the US
\fIMM\fP\fB/\fP\fIDD\fP\fB/\fP\fIYY\fP \fIhh\fP\fB:\fP\fImm\fP format
.TP
.B \fB\-E\fP
prints full time\-date stamps in the European
\fIdd\fP\fB\&.\fP\fImm\fP\fB\&.\fP\fIyyyy\fP \fIhh\fP\fB:\fP\fImm\fP format
.TP
.B \fB\-i\fP
prints full time\-date stamps in ISO8601
\fIyyyy\fP\fB\-\fP\fImm\fP\fB\-\fP\fIdd\fP \fIhh\fP\fB:\fP\fImm\fP format
.TP
.B \fB\-t\fP \fIfmt\fP
prints time and date stamps in the given format;
\fIfmt\fP is formatted with the strftime function with the zsh extensions
described for the \fB%D{\fP\fIstring\fP\fB}\fP prompt format in
Simple Prompt Escapes\&.
The resulting formatted string must be
no more than 256 characters or will not be printed
.TP
.B \fB\-D\fP
prints elapsed times; may be combined with one of the
options above
.UNINDENT
.sp
\fBfc \-p\fP pushes the current history list onto a stack and switches to a
new history list.  If the \fB\-a\fP option is also specified, this history list
will be automatically popped when the current function scope is exited, which
is a much better solution than creating a trap function to call \fBfc \-P\fP
manually.  If no arguments are specified, the history list is left empty,
\fB$HISTFILE\fP is unset, and \fB$HISTSIZE\fP & \fB$SAVEHIST\fP are set to their
default values.  If one argument is given, \fB$HISTFILE\fP is set to that
filename, \fB$HISTSIZE\fP & \fB$SAVEHIST\fP are left unchanged, and the history
file is read in (if it exists) to initialize the new list.  If a second
argument is specified, \fB$HISTSIZE\fP & \fB$SAVEHIST\fP are instead set to the
single specified numeric value.  Finally, if a third argument is specified,
\fB$SAVEHIST\fP is set to a separate value from \fB$HISTSIZE\fP\&.  You are free to
change these environment values for the new history list however you desire
in order to manipulate the new history list.
.sp
\fBfc \-P\fP pops the history list back to an older list saved by \fBfc \-p\fP\&.
The current list is saved to its \fB$HISTFILE\fP before it is destroyed
(assuming that \fB$HISTFILE\fP and \fB$SAVEHIST\fP are set appropriately, of
course).  The values of \fB$HISTFILE\fP, \fB$HISTSIZE\fP, and \fB$SAVEHIST\fP are
restored to the values they had when \fBfc \-p\fP was called.  Note that this
restoration can conflict with making these variables \(dqlocal\(dq, so your best
bet is to avoid local declarations for these variables in functions that use
\fBfc \-p\fP\&.  The one other guaranteed\-safe combination is declaring these
variables to be local at the top of your function and using the automatic
option (\fB\-a\fP) with \fBfc \-p\fP\&.  Finally, note that it is legal to manually
pop a push marked for automatic popping if you need to do so before the
function exits.
.sp
\fBfc \-R\fP reads the history from the given file,
\fBfc \-W\fP writes the history out to the given file,
and \fBfc \-A\fP appends the history out to the given file.
If no filename is specified, the \fB$HISTFILE\fP is assumed.
If the \fB\-I\fP option is added to \fB\-R\fP, only those events that are
not already contained within the internal history list are added.
If the \fB\-I\fP option is added to \fB\-A\fP or \fB\-W\fP, only those
events that are new since last incremental append/write to
the history file are appended/written.
In any case, the created file will have no more than \fB$SAVEHIST\fP
entries.
.UNINDENT
.UNINDENT
.sp
\fBfg\fP [ \fIjob\fP ... ]
.sp
\fIjob\fP ...
.INDENT 0.0
.INDENT 3.5
Bring each specified \fIjob\fP in turn to the foreground.
If no \fIjob\fP is specified, resume the current job.
.UNINDENT
.UNINDENT
.sp
\fBfloat\fP [ {\fB+|\-}Hghlprtux\fP ] [ {\fB+|\-}EFLRZ\fP [ \fIn\fP ] ] [ \fIname\fP[\fB=\fP\fIvalue\fP] ... ]
.INDENT 0.0
.INDENT 3.5
Equivalent to \fBtypeset \-E\fP, except that options irrelevant to floating
point numbers are not permitted.
.UNINDENT
.UNINDENT
.sp
\fBfunctions\fP [ {\fB+|\-}UkmtTuWz\fP ] [ \fB\-x\fP \fInum\fP ] [ \fIname\fP ... ]
.sp
\fBfunctions \-c\fP \fIoldfn\fP \fInewfn\fP
.sp
\fBfunctions \-M\fP [\fB\-s\fP] \fImathfn\fP [ \fImin\fP [ \fImax\fP [ \fIshellfn\fP ] ] ]
.sp
\fBfunctions \-M\fP [ \fB\-m\fP \fIpattern\fP ... ]
.sp
\fBfunctions +M\fP [ \fB\-m\fP ] \fImathfn\fP ...
.INDENT 0.0
.INDENT 3.5
Equivalent to \fBtypeset \-f\fP, with the exception of the \fB\-c\fP, \fB\-x\fP,
\fB\-M\fP and \fB\-W\fP options.  For \fBfunctions \-u\fP and \fBfunctions \-U\fP,
see \fBautoload\fP, which provides additional options.  For \fBfunctions \-t\fP
and \fBfunctions \-T\fP, see \fBtypeset \-f\fP\&.
.sp
The \fB\-x\fP option indicates that any functions output will have
each leading tab for indentation, added by the shell to show syntactic
structure, expanded to the given number \fInum\fP of spaces.  \fInum\fP
can also be 0 to suppress all indentation.
.sp
The \fB\-W\fP option turns on the option \fBWARN_NESTED_VAR\fP for the named
function or functions only.  The option is turned off at the start of
nested functions (apart from anonymous functions) unless the called
function also has the \fB\-W\fP attribute.
.sp
The \fB\-c\fP option causes \fIoldfn\fP to be copied to \fInewfn\fP\&.  The
copy is efficiently handled internally by reference counting.  If
\fIoldfn\fP was marked for autoload it is first loaded and if this
fails the copy fails.  Either function may subsequently be redefined
without affecting the other.  A typical idiom is that \fIoldfn\fP is the
name of a library shell function which is then redefined to call
\fBnewfn\fP, thereby installing a modified version of the function.
.sp
\fIThe \(ga\(ga\fP\-M\(ga\(ga:emphasis:\(ga and \fI\(ga\(ga+M\(ga\fP:emphasis:\(ga flags\(ga
\&.. index:: single: defining mathematical functions; Command
.sp
Use of the \fB\-M\fP option may not be combined with any of the options
handled by \fBtypeset \-f\fP\&.
.sp
\fBfunctions \-M\fP \fImathfn\fP defines \fImathfn\fP as the name of
a mathematical function recognised in all forms of arithmetical expressions;
see Arithmetic Evaluation\&.
By default \fImathfn\fP may take
any number of comma\-separated arguments.  If \fImin\fP is given,
it must have exactly \fImin\fP args; if \fImin\fP and \fImax\fP are
both given, it must have at least \fImin\fP and at most \fImax\fP
args.  \fImax\fP may be \-1 to indicate that there is no upper limit.
.sp
By default the function is implemented by a shell function of the same
name; if \fIshellfn\fP is specified it gives the name of the corresponding
shell function while \fImathfn\fP remains the name used in arithmetical
expressions.  The name of the function in \fB$0\fP is \fImathfn\fP (not
\fIshellfn\fP as would usually be the case), provided the option
\fBFUNCTION_ARGZERO\fP is in effect.  The positional parameters in the shell
function correspond to the arguments of the mathematical function call.
.sp
The result of the last arithmetical expression evaluated inside the shell
function gives the result of the mathematical function.  This is not limited to
arithmetic substitutions of the form \fB$((\fP\fI\&...\fP\fB))\fP,
but also includes arithmetical expressions evaluated in any other way, including
by the \fBlet\fP builtin,
by \fB((\fP\fI\&...\fP\fB))\fP statements,
and even
by the \fBreturn\fP builtin
and
by array subscripts.
Therefore, care must be taken not to use syntactical constructs that perform
arithmetic evaluation after evaluating what is to be the result of the function.
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 # WRONG
 zmath_cube() {
   (( $1 * $1 * $1 ))
   return 0
 }
 functions \-M cube 1 1 zmath_cube
 print $(( cube(3) ))
.EE
.UNINDENT
.UNINDENT
.sp
This will print \fB0\fP because of the \fBreturn\fP\&.
.sp
Commenting the \fBreturn\fP out would lead to a different problem: the
\fB((\fP\fI\&...\fP\fB))\fP statement would become
the last statement in the function, so the \fIreturn status\fP (\fB$?\fP) of the
function would be non\-zero (indicating failure) whenever the \fIarithmetic
result\fP of the function would happen to be zero (numerically):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 # WRONG
 zmath_cube() {
   (( $1 * $1 * $1 ))
 }
 functions \-M cube 1 1 zmath_cube
 print $(( cube(0) ))
.EE
.UNINDENT
.UNINDENT
.sp
Instead, the \fBtrue\fP builtin can be used:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 # RIGHT
 zmath_cube() {
   (( $1 * $1 * $1 ))
   true
 }
 functions \-M cube 1 1 zmath_cube
 print $(( cube(3) ))
.EE
.UNINDENT
.UNINDENT
.sp
If the additional option \fB\-s\fP is given to \fBfunctions \-M\fP, the
argument to the function is a single string: anything between the
opening and matching closing parenthesis is passed to the function as a
single argument, even if it includes commas or white space.  The minimum
and maximum argument specifiers must therefore be 1 if given.  An empty
argument list is passed as a zero\-length string.
Thus, the following string function takes a single argument, including
the commas, and prints 11:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 stringfn() { (( $#1 )); true }
 functions \-Ms stringfn
 print $(( stringfn(foo,bar,rod) ))
.EE
.UNINDENT
.UNINDENT
.sp
\fBfunctions \-M\fP with no arguments lists all such user\-defined functions in
the same form as a definition.  With the additional option \fB\-m\fP and
a list of arguments, all functions whose \fImathfn\fP matches one of
the pattern arguments are listed.
.sp
\fBfunction +M\fP removes the list of mathematical functions; with the
additional option \fB\-m\fP the arguments are treated as patterns and
all functions whose \fImathfn\fP matches the pattern are removed.  Note
that the shell function implementing the behaviour is not removed
(regardless of whether its name coincides with \fImathfn\fP).
.UNINDENT
.UNINDENT
.sp
\fBgetcap\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/cap Module\&.
.UNINDENT
.UNINDENT
.sp
\fBgetln\fP [ \fB\-AclneE\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Read the top value from the buffer stack and put it in
the shell parameter \fIname\fP\&.  Equivalent to
\fBread \-zr\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBgetopts\fP [ \fB\-p\fP ] \fIoptstring\fP \fIname\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Checks the \fIarg\fPs for legal options.  If the \fIarg\fPs are omitted,
the positional parameters are used.  A valid option argument
begins with a \fB+\fP or a \fB\-\fP\&.  An argument not beginning with
a \fB+\fP or a \fB\-\fP, or the argument \fB\-\fP\fB\-\fP, ends the options.
Note that a single \fB\-\fP is not considered a valid option argument.
\fIoptstring\fP contains the letters that \fBgetopts\fP
recognizes.  If a letter is followed by a \fB:\fP, that option
requires an argument.  The argument may appear either immediately
following the option in the same word, or in the next word.
.sp
Each time it is invoked, \fBgetopts\fP places the option letter it finds
in the shell parameter \fIname\fP, prepended with a \fB+\fP when
\fIarg\fP begins with a \fB+\fP\&.  The index of the next \fIarg\fP
is stored in \fBOPTIND\fP\&.  The option argument, if any,
is stored in \fBOPTARG\fP\&.
\&.. index:: single: OPTIND, use of; Variable
.sp
When the terminator \fB\-\fP\fB\-\fP is encountered, \fBOPTIND\fP is
incremented such that it can be \fBshift\fPed away with the options.  This
is not true of other non\-option arguments, including a single \fB\-\fP\&.
.sp
The first option to be examined may be changed by explicitly assigning
to \fBOPTIND\fP\&.  \fBOPTIND\fP has an initial value of \fB1\fP, and is
normally set to \fB1\fP upon entry to a shell function and restored
upon exit.  \fBOPTARG\fP is not reset and retains its value from the most
recent call to \fBgetopts\fP\&.  If either of \fBOPTIND\fP or \fBOPTARG\fP is
explicitly unset, it remains unset, and the index or option argument is
not stored.  The option itself is still stored in \fIname\fP in this case.
.sp
A leading \fB:\fP in \fIoptstring\fP causes \fBgetopts\fP to store the
letter of any invalid option in \fBOPTARG\fP, and to set \fIname\fP to
\fB?\fP for an unknown option and to \fB:\fP when a required argument is
missing.  Otherwise, \fBgetopts\fP sets \fIname\fP to \fB?\fP and prints
an error message when an option is invalid.  The exit status is
nonzero when there are no more options.
.sp
When either the \fBPOSIX_BUILTINS\fP option is enabled or the \fB\-p\fP
option is given to \fBgetopts\fP itself, \fBgetopts\fP behaves in a more
POSIX\-compatible manner.  Specifically, handling of
\fB+\fP\-prefixed options is disabled (they are treated as
non\-options) and the value of \fBOPTIND\fP is calculated differently.
Additionally, with \fBPOSIX_BUILTINS\fP (but not with \fB\-p\fP), the value
of \fBOPTIND\fP is not kept local to the calling function.
.UNINDENT
.UNINDENT
.sp
\fBhash\fP [ \fB\-Ldfmrv\fP ] [ \fIname\fP[\fB=\fP\fIvalue\fP] ] ...
.INDENT 0.0
.INDENT 3.5
\fBhash\fP can be used to directly modify the contents of the command
hash table, and the named directory hash table.  Normally one would
modify these tables by modifying one\(aqs \fBPATH\fP
(for the command hash table) or by creating appropriate shell parameters
(for the named directory hash table).
The choice of hash table to work on is determined by the \fB\-d\fP option;
without the option the command hash table is used, and with the option the
named directory hash table is used.
.sp
A command \fIname\fP starting with a \fB/\fP or with a relative path
starting with \fB\&./\fP or \fB\&../\fP is never executed by lookup in
the command hash table, and these can only be added to the table by
explicit use of the \fBhash\fP command.  Such a command is always
found by direct look up in the file system.
.sp
Given no arguments, and neither the \fB\-r\fP or \fB\-f\fP options,
the selected hash table will be listed in full.
.sp
The \fB\-r\fP option causes the selected hash table to be emptied.
It will be subsequently rebuilt in the normal fashion.
The \fB\-f\fP option causes the selected hash table to be fully
rebuilt immediately.  For the command hash table this hashes
all (and \fIonly\fP) the absolute directories in the \fBPATH\fP,
and for the named directory hash table this adds all users\(aq home
directories.
These two options cannot be used with any arguments.
Both options remove any explicitly\-added elements.
.sp
The \fB\-m\fP option causes the arguments to be taken as patterns
(which should be quoted) and the elements of the hash table
matching those patterns are printed.  This is the only way to display
a limited selection of hash table elements.
.sp
For each \fIname\fP with a corresponding \fIvalue\fP, put \fIname\fP in
the selected hash table, associating it with the pathname \fIvalue\fP\&.
In the command hash table, this means that
whenever \fIname\fP is used as a command argument, the shell will try
to execute the file given by \fIvalue\fP\&.
In the named directory hash table, this means
that \fIvalue\fP may be referred to as \fB~\fP\fIname\fP\&.
.sp
For each \fIname\fP with no
corresponding \fIvalue\fP, attempt to add \fIname\fP to the hash table,
checking what the appropriate \fBvalue\fP is in the normal manner for
that hash table.  If an appropriate \fBvalue\fP can\(aqt be found, then
the hash table will be unchanged.
.sp
The \fB\-v\fP option causes hash table entries to be listed as they are
added by explicit specification.  If has no effect if used with \fB\-f\fP\&.
.sp
If the \fB\-L\fP flag is present, then each hash table entry is printed in
the form of a call to hash.
.UNINDENT
.UNINDENT
.sp
\fBhistory\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBfc \-l\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBinteger\fP [ {\fB+|\-}Hghlprtux\fP ] [ {\fB+|\-}LRZi\fP [ \fIn\fP ] ] [ \fIname\fP[\fB=\fP\fIvalue\fP] ... ]
.INDENT 0.0
.INDENT 3.5
Equivalent to \fBtypeset \-i\fP, except that options irrelevant to
integers are not permitted.
.UNINDENT
.UNINDENT
.sp
\fBjobs\fP [ \fB\-dlprs\fP ] [ \fIjob\fP ... ]
.sp
\fBjobs \-Z\fP \fIstring\fP
.INDENT 0.0
.INDENT 3.5
Lists information about each given job, or all jobs
if \fIjob\fP is omitted.  The \fB\-l\fP flag lists process
IDs, and the \fB\-p\fP flag lists process groups.
If the \fB\-r\fP flag is specified only running jobs will be listed
and if the \fB\-s\fP flag is given only stopped jobs are shown.
If the \fB\-d\fP flag is given, the directory from which the job was
started (which may not be the current directory of the job) will also
be shown.
.sp
The \fB\-Z\fP option replaces the shell\(aqs argument and environment space with
the given string, truncated if necessary to fit.  This will normally be
visible in \fBps\fP (\fBps(1)\fP) listings.  This feature is typically
used by daemons, to indicate their state.
.sp
Full job control is only available in the top\-level interactive shell,
not in commands run in the left hand side of pipelines or within
the \fB(\fP\fI\&...\fP\fB)\fP construct.  However, a snapshot
of the job state at that point is taken, so it is still possible
to use the \fBjobs\fP builtin, or any parameter providing job information.
This gives information about the state of jobs at the point the subshell
was created.  If background processes are created within the subshell,
then instead information about those processes is provided.
.sp
For example,
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 sleep 10 &    # Job in background
 (             # Shell forks
 jobs          # Shows information about \(dqsleep 10 &\(dq
 sleep 5 &     # Process in background (no job control)
 jobs          # Shows information about \(dqsleep 5 &\(dq
 )
.EE
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
\fBkill\fP [ \fB\-s\fP \fIsignal_name\fP | \fB\-n\fP \fIsignal_number\fP | \fB\-\fP\fIsig\fP ] [ \fB\-q\fP \fIvalue\fP ] \fIjob\fP ...
.sp
\fBkill\fP \fB\-l\fP [ \fIsig\fP ... ]
.sp
\fBkill\fP \fB\-L\fP
.INDENT 0.0
.INDENT 3.5
Sends either \fBSIGTERM\fP or the specified signal to the given
jobs or processes.
Signals are given by number or by names, with or without the \fBSIG\fP
prefix.
If the signal being sent is not \fBKILL\fP or \fBCONT\fP, then the job
will be sent a \fBCONT\fP signal if it is stopped.
The argument \fIjob\fP can be the process ID of a job
not in the job list.
In the second form, \fBkill \-l\fP, if \fIsig\fP is not
specified the signal names are listed.  Otherwise, for each
\fIsig\fP that is a name, the corresponding signal number is
listed.  For each \fIsig\fP that is a signal number or a number
representing the exit status of a process which was terminated or
stopped by a signal the name of the signal is printed.  The final
form with \fB\-L\fP lists each signal name with its corresponding number.
.sp
On some systems, alternative signal names are allowed for a few signals.
Typical examples are \fBSIGCHLD\fP and \fBSIGCLD\fP or \fBSIGPOLL\fP and
\fBSIGIO\fP, assuming they correspond to the same signal number.  \fBkill
\-l \(ga\(gawill only list the preferred form, however\fP kill \-l\(ga\(ga \fIalt\fP will
show if the alternative form corresponds to a signal number.  For example,
under Linux \fBkill \-l IO\fP and \fBkill \-l POLL\fP both output 29, hence
\fBkill \-IO\fP and \fBkill \-POLL\fP have the same effect.
.sp
Many systems will allow process IDs to be negative to kill a process
group or zero to kill the current process group.
.sp
The \fB\-q\fP option allows an integer value to be sent with the signal
on systems that support \fBsigqueue()\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBlet\fP \fIarg\fP ...
.INDENT 0.0
.INDENT 3.5
Evaluate each \fIarg\fP as an arithmetic expression.
See Arithmetic Evaluation
for a description of arithmetic expressions.  The exit status is 0 if the
value of the last expression is nonzero, 1 if it is zero, and 2 if
an error occurred.
.UNINDENT
.UNINDENT
.sp
\fBlimit\fP [ \fB\-hs\fP ] [ \fIresource\fP [ \fIlimit\fP ] ] ...
.INDENT 0.0
.INDENT 3.5
Set or display resource limits.  Unless the \fB\-s\fP flag is given,
the limit applies only the children of the shell.  If \fB\-s\fP is
given without other arguments, the resource limits of the current
shell is set to the previously set resource limits of the children.
.sp
If \fIlimit\fP is not specified, print the current limit placed
on \fIresource\fP, otherwise
set the limit to the specified value.  If the \fB\-h\fP flag
is given, use hard limits instead of soft limits.
If no \fIresource\fP is given, print all limits.
.sp
When looping over multiple resources, the shell will abort immediately if
it detects a badly formed argument.  However, if it fails to set a limit
for some other reason it will continue trying to set the remaining limits.
.sp
\fIresource\fP can be one of:
.INDENT 0.0
.TP
.B \fBaddressspace\fP
Maximum amount of address space used.
.TP
.B \fBaiomemorylocked\fP
Maximum amount of memory locked in RAM for AIO operations.
.TP
.B \fBaiooperations\fP
Maximum number of AIO operations.
.TP
.B \fBcachedthreads\fP
Maximum number of cached threads.
.TP
.B \fBcoredumpsize\fP
Maximum size of a core dump.
.TP
.B \fBcputime\fP
Maximum CPU seconds per process.
.TP
.B \fBdatasize\fP
Maximum data size (including stack) for each process.
.TP
.B \fBdescriptors\fP
Maximum value for a file descriptor.
.TP
.B \fBfilesize\fP
Largest single file allowed.
.TP
.B \fBkqueues\fP
Maximum number of kqueues allocated.
.TP
.B \fBmaxfilelocks\fP
Maximum number of file locks.
.TP
.B \fBmaxproc\fP
Maximum number of processes.
.TP
.B \fBmaxpthreads\fP
Maximum number of threads per process.
.TP
.B \fBmemorylocked\fP
Maximum amount of memory locked in RAM.
.TP
.B \fBmemoryuse\fP
Maximum resident set size.
.TP
.B \fBmsgqueue\fP
Maximum number of bytes in POSIX message queues.
.TP
.B \fBnice\fP
Maximum nice value.
.TP
.B \fBpipebuf\fP
Maximum size of buffers for pipes/fifos.
.TP
.B \fBposixlocks\fP
Maximum number of POSIX locks per user.
.TP
.B \fBpseudoterminals\fP
Maximum number of pseudo\-terminals.
.TP
.B \fBresident\fP
Maximum resident set size.
.TP
.B \fBrt_priority\fP
Maximum real\-time priority.
.TP
.B \fBrt_time\fP
Maximum CPU time without a blocking system call.
.TP
.B \fBsigpending\fP
Maximum number of pending signals.
.TP
.B \fBsockbufsize\fP
Maximum size of all socket buffers.
.TP
.B \fBstacksize\fP
Maximum stack size for each process.
.TP
.B \fBswapsize\fP
Maximum amount of swap used.
.TP
.B \fBumtxp\fP
Maximum number of POSIX thread library objects.
.TP
.B \fBvmemorysize\fP
Maximum amount of virtual memory.
.TP
.B \fBvnodemonitors\fP
Maximum number of open vnode monitors.
.UNINDENT
.sp
Which of these resource limits are available depends on the system.
\fIresource\fP can be abbreviated to any unambiguous prefix.  It
can also be an integer, which corresponds to the integer defined
for the resource by the operating system.
.sp
If argument corresponds to a number which is out of the range of the
resources configured into the shell, the shell will try to read or write
the limit anyway, and will report an error if this fails.  As the shell
does not store such resources internally, an attempt to set the limit will
fail unless the \fB\-s\fP option is present.
.sp
\fIlimit\fP is a number, with an optional scaling factor, as follows:
.INDENT 0.0
.TP
.B \fIn\fP\fBh\fP
hours
.TP
.B \fIn\fP\fBk\fP
kilobytes (default)
.TP
.B \fIn\fP\fBm\fP
megabytes or minutes
.TP
.B \fIn\fP\fBg\fP
gigabytes
.TP
.B [\fImm\fP\fB:\fP]:var:\fIss\fP
minutes and seconds
.UNINDENT
.sp
The \fBlimit\fP command is not made available by default when the
shell starts in a mode emulating another shell.  It can be made available
with the command \fBzmodload \-F zsh/rlimits b:limit\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBlocal\fP [ {\fB+|\-}AHUahlprtux\fP ] [ {\fB+|\-}EFLRZi\fP [ \fIn\fP ] ] [ \fIname\fP[\fB=\fP\fIvalue\fP] ... ]
.INDENT 0.0
.INDENT 3.5
Same as \fBtypeset\fP, except that the options \fB\-g\fP, and
\fB\-f\fP are not permitted.  In this case the \fB\-x\fP option does not force
the use of \fB\-g\fP, i.e. exported variables will be local to functions.
.UNINDENT
.UNINDENT
.sp
\fBlogout\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Same as \fBexit\fP, except that it only works in a login shell.
.UNINDENT
.UNINDENT
.sp
\fBnoglob\fP \fIsimple command\fP
.INDENT 0.0
.INDENT 3.5
See Precommand Modifiers\&.
.UNINDENT
.UNINDENT
.sp
\fBpopd\fP [ \fB\-q\fP ] [ {\fB+|\-\fP}:var:\fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Remove an entry from the directory stack, and perform a \fBcd\fP to
the new top directory.  With no argument, the current top entry is
removed.  An argument of the form \fB+\fP\fIn\fP identifies a stack
entry by counting from the left of the list shown by the \fBdirs\fP command,
starting with zero.  An argument of the form \fB\-\fP\fIn\fP counts from the right.
\&.. index:: single: PUSHD_MINUS, use of; Program
.sp
If the \fBPUSHD_MINUS\fP option is set, the meanings of \fB+\fP and
\fB\-\fP in this context are swapped.
.sp
If the \fB\-q\fP (quiet) option is specified, the hook function \fBchpwd\fP
and the functions in the array \fB$chpwd_functions\fP are not called,
and the new directory stack is not printed.  This is useful for calls to
\fBpopd\fP that do not change the environment seen by an interactive user.
.UNINDENT
.UNINDENT
.sp
\fBprint\fP [ \fB\-abcDilmnNoOpPrsSz\fP ] [ \fB\-u\fP \fIn\fP ] [ \fB\-f\fP \fIformat\fP ] [ \fB\-C\fP \fIcols\fP ]
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.INDENT 3.5
[ \fB\-v\fP \fIname\fP ] [ \fB\-xX\fP \fItabstop\fP ] [ \fB\-R\fP [ \fB\-en\fP ]] [ \fIarg\fP ... ]
.UNINDENT
.UNINDENT
.sp
With the \fB\-f\fP option the arguments are printed as described by \fBprintf\fP\&.
With no flags or with the flag \fB\-\fP, the arguments are printed on
the standard output as described by \fBecho\fP, with the following differences:
the escape sequence \fB\eM\-\fP\fIx\fP (or \fB\eM\fP\fIx\fP) metafies the character
\fIx\fP (sets the highest bit),
\fB\eC\-\fP\fIx\fP (or \fB\eC\fP\fIx\fP) produces a control character
(\fB\eC\-@\fP and \fB\eC\-?\fP give the characters NULL and delete),
a character code in octal is represented by \fB\e\fP\fINNN\fP
(instead of \fB\e0\fP\fINNN\fP),
and \fB\eE\fP is a synonym for \fB\ee\fP\&.
Finally, if not in an escape
sequence, \fB\e\fP escapes the following character and is not printed.
.sp
\fB\-a\fP
.INDENT 0.0
.INDENT 3.5
Print arguments with the column incrementing first.  Only useful with the
\fB\-c\fP and \fB\-C\fP options.
.UNINDENT
.UNINDENT
.sp
\fB\-b\fP
.INDENT 0.0
.INDENT 3.5
Recognize all the escape sequences defined for the \fBbindkey\fP command,
see Zle Builtins\&.
.UNINDENT
.UNINDENT
.sp
\fB\-c\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments in columns.  Unless \fB\-a\fP is also given, arguments are
printed with the row incrementing first.
.UNINDENT
.UNINDENT
.sp
\fB\-C\fP \fIcols\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments in \fIcols\fP columns.  Unless \fB\-a\fP is also given,
arguments are printed with the row incrementing first.
.UNINDENT
.UNINDENT
.sp
\fB\-D\fP
.INDENT 0.0
.INDENT 3.5
Treat the arguments as paths, replacing directory prefixes with \fB~\fP
expressions corresponding to directory names, as appropriate.
.UNINDENT
.UNINDENT
.sp
\fB\-i\fP
.INDENT 0.0
.INDENT 3.5
If given together with \fB\-o\fP or \fB\-O\fP, sorting is performed
case\-independently.
.UNINDENT
.UNINDENT
.sp
\fB\-l\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments separated by newlines instead of spaces.  Note: if
the list of arguments is empty, \fBprint \-l\fP will still output one empty
line. To print a possibly\-empty list of arguments one per line, use
\fBprint \-C1\fP, as in \fBprint \-rC1 \-\- \(dq$list[@]\(dq\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-m\fP
.INDENT 0.0
.INDENT 3.5
Take the first argument as a pattern (should be quoted), and remove
it from the argument list together with subsequent arguments that
do not match this pattern.
.UNINDENT
.UNINDENT
.sp
\fB\-n\fP
.INDENT 0.0
.INDENT 3.5
Do not add a newline to the output.
.UNINDENT
.UNINDENT
.sp
\fB\-N\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments separated and terminated by nulls. Again,
\fBprint \-rNC1 \-\- \(dq$list[@]\(dq\fP is a canonical way to print an
arbitrary list as null\-delimited records.
.UNINDENT
.UNINDENT
.sp
\fB\-o\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments sorted in ascending order.
.UNINDENT
.UNINDENT
.sp
\fB\-O\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments sorted in descending order.
.UNINDENT
.UNINDENT
.sp
\fB\-p\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments to the input of the coprocess.
.UNINDENT
.UNINDENT
.sp
\fB\-P\fP
.INDENT 0.0
.INDENT 3.5
Perform prompt expansion (see
Expansion of Prompt Sequences).
In combination with \fB\-f\fP,
prompt escape sequences are parsed only within interpolated arguments,
not within the format string.
.UNINDENT
.UNINDENT
.sp
\fB\-r\fP
.INDENT 0.0
.INDENT 3.5
Ignore the escape conventions of \fBecho\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-R\fP
.INDENT 0.0
.INDENT 3.5
Emulate the BSD \fBecho\fP command, which does not process escape sequences
unless the \fB\-e\fP flag is given.  The \fB\-n\fP flag suppresses the trailing
newline.  Only the \fB\-e\fP and \fB\-n\fP flags are recognized after
\fB\-R\fP; all other arguments and options are printed.
.UNINDENT
.UNINDENT
.sp
\fB\-s\fP
.INDENT 0.0
.INDENT 3.5
Place the results in the history list instead of on the standard output.
Each argument to the \fBprint\fP command is treated as a single word in the
history, regardless of its content.
.UNINDENT
.UNINDENT
.sp
\fB\-S\fP
.INDENT 0.0
.INDENT 3.5
Place the results in the history list instead of on the standard output.
In this case only a single argument is allowed; it will be split into
words as if it were a full shell command line.  The effect is
similar to reading the line from a history file with the
\fBHIST_LEX_WORDS\fP option active.
.UNINDENT
.UNINDENT
.sp
\fB\-u\fP \fIn\fP
.INDENT 0.0
.INDENT 3.5
Print the arguments to file descriptor \fIn\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-v\fP \fIname\fP
.INDENT 0.0
.INDENT 3.5
Store the printed arguments as the value of the parameter \fIname\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-x\fP \fItab\-stop\fP
.INDENT 0.0
.INDENT 3.5
Expand leading tabs on each line of output in the printed string
assuming a tab stop every \fItab\-stop\fP characters.  This is appropriate
for formatting code that may be indented with tabs.  Note that leading
tabs of any argument to print, not just the first, are expanded, even if
\fBprint\fP is using spaces to separate arguments (the column count
is maintained across arguments but may be incorrect on output
owing to previous unexpanded tabs).
.sp
The start of the output of each print command is assumed to be aligned
with a tab stop.  Widths of multibyte characters are handled if the
option \fBMULTIBYTE\fP is in effect.  This option is ignored if other
formatting options are in effect, namely column alignment or
\fBprintf\fP style, or if output is to a special location such as shell
history or the command line editor.
.UNINDENT
.UNINDENT
.sp
\fB\-X\fP \fItab\-stop\fP
.INDENT 0.0
.INDENT 3.5
This is similar to \fB\-x\fP, except that all tabs in the printed string
are expanded.  This is appropriate if tabs in the arguments are
being used to produce a table format.
.UNINDENT
.UNINDENT
.sp
\fB\-z\fP
.INDENT 0.0
.INDENT 3.5
Push the arguments onto the editing buffer stack, separated by spaces.
.UNINDENT
.UNINDENT
.sp
If any of \fB\-m\fP, \fB\-o\fP or \fB\-O\fP are used in combination with
\fB\-f\fP and there are no arguments (after the removal process in the
case of \fB\-m\fP) then nothing is printed.
.UNINDENT
.UNINDENT
.sp
\fBprintf\fP [ \fB\-v\fP \fIname\fP ] \fIformat\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Print the arguments according to the format specification. Formatting
rules are the same as used in C. The same escape sequences as for \fBecho\fP
are recognised in the format. All C conversion specifications ending in
one of \fBcsdiouxXeEfgGn\fP are handled. In addition to this, \fB%b\fP can be
used instead of \fB%s\fP to cause escape sequences in the argument to be
recognised and \fB%q\fP can be used to quote the argument in such a way
that allows it to be reused as shell input. With the numeric format
specifiers, if the corresponding argument starts with a quote character,
the numeric value of the following character is used as the number to
print; otherwise the argument is evaluated as an arithmetic expression. See
Arithmetic Evaluation for a description of arithmetic
expressions. With \fB%n\fP, the corresponding argument is taken as an
identifier which is created as an integer parameter.
.sp
Normally, conversion specifications are applied to each argument in order
but they can explicitly specify the \fIn\fPth argument is to be used by
replacing \fB%\fP by \fB%\fP\fIn\fP\fB$\fP and \fB*\fP by \fB*\fP\fIn\fP\fB$\fP\&.
It is recommended that you do not mix references of this explicit style
with the normal style and the handling of such mixed styles may be subject
to future change.
.sp
If arguments remain unused after formatting, the format string is reused
until all arguments have been consumed. With the \fBprint\fP builtin, this
can be suppressed by using the \fB\-r\fP option. If more arguments are
required by the format than have been specified, the behaviour is as if
zero or an empty string had been specified as the argument.
.sp
The \fB\-v\fP option causes the output to be stored as the value of the
parameter \fIname\fP, instead of printed. If \fIname\fP is an array and
the format string is reused when consuming arguments then one
array element will be used for each use of the format string.
.UNINDENT
.UNINDENT
.sp
\fBpushd\fP [ \fB\-qsLP\fP ] [ \fIarg\fP ]
.sp
\fBpushd\fP [ \fB\-qsLP\fP ] \fIold\fP \fInew\fP
.sp
\fBpushd\fP [ \fB\-qsLP\fP ] {\fB+|\-\fP}:var:\fIn\fP
.INDENT 0.0
.INDENT 3.5
Change the current directory, and push the old current directory
onto the directory stack.  In the first form, change the
current directory to \fIarg\fP\&.
If \fIarg\fP is not specified, change to the second directory
on the stack (that is, exchange the top two entries), or
change to \fB$HOME\fP if the \fBPUSHD_TO_HOME\fP
option is set or if there is only one entry on the stack.
Otherwise, \fIarg\fP is interpreted as it would be by \fBcd\fP\&.
The meaning of \fIold\fP and \fInew\fP in the second form is also
the same as for \fBcd\fP\&.
.sp
The third form of \fBpushd\fP changes directory by rotating the
directory list.  An argument of the form \fB+\fP\fIn\fP identifies a stack
entry by counting from the left of the list shown by the \fBdirs\fP
command, starting with zero.  An argument of the form \fB\-\fP\fIn\fP counts
from the right.  If the \fBPUSHD_MINUS\fP option is set, the meanings
of \fB+\fP and \fB\-\fP in this context are swapped.
.sp
If the \fB\-q\fP (quiet) option is specified, the hook function \fBchpwd\fP
and the functions in the array \fB$chpwd_functions\fP are not called,
and the new directory stack is not printed.  This is useful for calls to
\fBpushd\fP that do not change the environment seen by an interactive user.
.sp
If the option \fB\-q\fP is not specified and the shell option \fBPUSHD_SILENT\fP
is not set, the directory stack will be printed after a \fBpushd\fP is
performed.
.sp
The options \fB\-s\fP, \fB\-L\fP and \fB\-P\fP have the same meanings as for the
\fBcd\fP builtin.
.UNINDENT
.UNINDENT
.sp
\fBpushln\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Equivalent to \fBprint \-nz\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBpwd\fP [ \fB\-rLP\fP ]
.INDENT 0.0
.INDENT 3.5
Print the absolute pathname of the current working directory.
If the \fB\-r\fP or the \fB\-P\fP flag is specified, or the \fBCHASE_LINKS\fP
option is set and the \fB\-L\fP flag is not given, the printed path will not
contain symbolic links.
.UNINDENT
.UNINDENT
.sp
\fBr\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBfc \-e \-\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBread\fP [ \fB\-rszpqAclneE\fP ] [ \fB\-t\fP [ \fInum\fP ] ] [ \fB\-k\fP [ \fInum\fP ] ] [ \fB\-d\fP \fIdelim\fP ]
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.INDENT 3.5
[ \fB\-u\fP \fIn\fP ] [ [\fIname\fP][\fB?\fP\fIprompt\fP] ] [ \fIname\fP ...  ]
.UNINDENT
.UNINDENT
.sp
Read one line and break it into fields using the characters
in \fB$IFS\fP as separators, except as noted below.
The first field is assigned to the first \fIname\fP, the second field
to the second \fIname\fP, etc., with leftover
fields assigned to the last \fIname\fP\&.
If \fIname\fP is omitted then
\fBREPLY\fP is used for scalars and \fBreply\fP for arrays.
.sp
\fB\-r\fP
.INDENT 0.0
.INDENT 3.5
Raw mode: a \fB\e\fP at the end of a line does not signify line
continuation and backslashes in the line don\(aqt quote the following
character and are not removed.
.UNINDENT
.UNINDENT
.sp
\fB\-s\fP
.INDENT 0.0
.INDENT 3.5
Don\(aqt echo back characters if reading from the terminal.
.UNINDENT
.UNINDENT
.sp
\fB\-q\fP
.INDENT 0.0
.INDENT 3.5
Read only one character from the terminal and set \fIname\fP to
\fBy\fP if this character was \fBy\fP or \fBY\fP and to \fBn\fP otherwise.
With this flag set the return status is zero only if the character was
\fBy\fP or \fBY\fP\&.  This option may be used with a timeout (see \fB\-t\fP); if
the read times out, or encounters end of file, status 2 is returned.  Input is
read from the terminal unless one of \fB\-u\fP or \fB\-p\fP is present.  This option
may also be used within zle widgets.
.UNINDENT
.UNINDENT
.sp
\fB\-k\fP [ \fInum\fP ]
.INDENT 0.0
.INDENT 3.5
Read only one (or \fInum\fP) characters.  All are assigned to the first
\fIname\fP, without word splitting.  This flag is ignored when \fB\-q\fP is
present.  Input is read from the terminal unless one of \fB\-u\fP or \fB\-p\fP
is present.  This option may also be used within zle widgets.
.sp
Note that despite the mnemonic \(gakey\(aq this option does read full
characters, which may consist of multiple bytes if the option
\fBMULTIBYTE\fP is set.
.UNINDENT
.UNINDENT
.sp
\fB\-z\fP
.INDENT 0.0
.INDENT 3.5
Read one entry from the editor buffer stack and assign it to the first
\fIname\fP, without word splitting.  Text is pushed onto the stack with
\fBprint \-z\fP or with \fBpush\-line\fP from the line editor (see
\fBzshzle\fP).
This flag is ignored when the \fB\-k\fP or \fB\-q\fP flags are present.
.UNINDENT
.UNINDENT
.sp
\fB\-e\fP
.sp
\fB\-E\fP
.INDENT 0.0
.INDENT 3.5
The input read is printed (echoed) to the standard output.  If the \fB\-e\fP
flag is used, no input is assigned to the parameters.
.UNINDENT
.UNINDENT
.sp
\fB\-A\fP
.INDENT 0.0
.INDENT 3.5
The first \fIname\fP is taken as the name of an array and all words are
assigned to it.
.UNINDENT
.UNINDENT
.sp
\fB\-c\fP
.sp
\fB\-l\fP
.INDENT 0.0
.INDENT 3.5
These flags are allowed only if called inside a
function used for completion (specified with the \fB\-K\fP flag to
\fBcompctl\fP).  If the \fB\-c\fP flag is given, the words of the
current command are read. If the \fB\-l\fP flag is given, the whole
line is assigned as a scalar.  If both flags are present, \fB\-l\fP
is used and \fB\-c\fP is ignored.
.UNINDENT
.UNINDENT
.sp
\fB\-n\fP
.INDENT 0.0
.INDENT 3.5
Together with \fB\-c\fP, the number of the word the cursor is on is
read.  With \fB\-l\fP, the index of the character the cursor is on is
read.  Note that the command name is word number 1, not word 0,
and that when the cursor is at the end of the line, its character
index is the length of the line plus one.
.UNINDENT
.UNINDENT
.sp
\fB\-u\fP \fIn\fP
.INDENT 0.0
.INDENT 3.5
Input is read from file descriptor \fIn\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-p\fP
.INDENT 0.0
.INDENT 3.5
Input is read from the coprocess.
.UNINDENT
.UNINDENT
.sp
\fB\-d\fP \fIdelim\fP
.INDENT 0.0
.INDENT 3.5
Input is terminated by the first character of \fIdelim\fP instead of
by newline.  For compatibility with other shells, if \fIdelim\fP is an
empty string, input is terminated at the first NUL.
.UNINDENT
.UNINDENT
.sp
\fB\-t\fP [ \fInum\fP ]
.INDENT 0.0
.INDENT 3.5
Test if input is available before attempting to read.  If \fInum\fP
is present, it must begin with a digit and will be evaluated
to give a number of seconds, which may be a floating point number;
in this case the read times out if input is not available within this
time.  If \fInum\fP is not present, it is taken to be zero, so that
\fBread\fP returns immediately if no input is available.
If no input is available, return status 1 and do not set any variables.
\&.. only:: man
.sp
This option is not available when reading from the editor buffer with
\fB\-z\fP, when called from within completion with \fB\-c\fP or \fB\-l\fP, with
\fB\-q\fP which clears the input queue before reading, or within zle where
other mechanisms should be used to test for input.
\&.. only:: man
.sp
Note that read does not attempt to alter the input processing mode.  The
default mode is canonical input, in which an entire line is read at a time,
so usually \fBread \-t\fP will not read anything until an entire line has
been typed.  However, when reading from the terminal with \fB\-k\fP
input is processed one key at a time; in this case, only availability of
the first character is tested, so that e.g. \fBread \-t \-k 2\fP can still
block on the second character.  Use two instances of \fBread \-t \-k\fP if
this is not what is wanted.
.UNINDENT
.UNINDENT
.sp
If the first argument contains a \fB?\fP, the remainder of this
word is used as a \fIprompt\fP on standard error when the shell
is interactive.
.sp
The value (exit status) of \fBread\fP is 1 when an end\-of\-file is
encountered, or when \fB\-c\fP or \fB\-l\fP is present and the command is
not called from a \fBcompctl\fP function, or as described for \fB\-q\fP\&.
Otherwise the value is 0.
.sp
The behavior of some combinations of the \fB\-k\fP, \fB\-p\fP, \fB\-q\fP, \fB\-u\fP
and \fB\-z\fP flags is undefined.  Presently \fB\-q\fP cancels all the others,
\fB\-p\fP cancels \fB\-u\fP, \fB\-k\fP cancels \fB\-z\fP, and otherwise \fB\-z\fP
cancels both \fB\-p\fP and \fB\-u\fP\&.
.sp
The \fB\-c\fP or \fB\-l\fP flags cancel any and all of \fB\-kpquz\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBreadonly\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBtypeset \-r\fP\&.  With the \fBPOSIX_BUILTINS\fP option set, same
as \fBtypeset \-gr\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBrehash\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBhash \-r\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBreturn\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Causes a shell function or \fB\&.\fP script to return to
the invoking script with the return status specified by
an arithmetic expression \fIn\fP\&.  Also causes a non\-interactive
shell to exit, allowing files containing shell code to be used
both as scripts and as autoloadable shell functions.
For example, the following prints \fB42\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 () { integer foo=40; return \(dqfoo + 2\(dq }
 echo $?
.EE
.UNINDENT
.UNINDENT
.sp
If \fIn\fP
is omitted, the return status is that of the last command
executed.
.sp
If \fBreturn\fP was executed from a trap in a \fBTRAP\fP\fINAL\fP function,
the effect is different for zero and non\-zero return status.  With zero
status (or after an implicit return at the end of the trap), the shell
will return to whatever it was previously processing; with a non\-zero
status, the shell will behave as interrupted except that the return
status of the trap is retained.  Note that the numeric value of the signal
which caused the trap is passed as the first argument, so the statement
\fBreturn \(dq128+$1\(dq\fP will return the same status as if the signal
had not been trapped.
.UNINDENT
.UNINDENT
.sp
\fBsched\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/sched Module\&.
.UNINDENT
.UNINDENT
.sp
\fBset\fP [ {\fB+|\-\fP}:var:\fIoptions\fP | {\fB+|\-}o\fP [ \fIoption_name\fP ] ] ... [ {\fB+|\-}A\fP [ \fIname\fP ] ]
.INDENT 0.0
.INDENT 3.5
[ \fIarg\fP ... ]
.sp
Set the options for the shell and/or set the positional parameters, or
declare and set an array.  If the \fB\-s\fP option is given, it causes the
specified arguments to be sorted before assigning them to the positional
parameters (or to the array \fIname\fP if \fB\-A\fP is used).  With \fB+s\fP
sort arguments in descending order.  For the meaning of the other flags, see
\fBzshoptions\fP\&.
Flags may be specified by name using the \fB\-o\fP option. If no option
name is supplied with \fB\-o\fP, the current option states are printed:  see
the description of \fBsetopt\fP below for more information on the format.
With \fB+o\fP they are printed in a form that can be used as input
to the shell.
.sp
If the \fB\-A\fP flag is specified, \fIname\fP is set to an array containing
the given \fIarg\fPs; if no \fIname\fP is specified, all arrays are printed
together with their values.
.sp
If \fB+A\fP is used and \fIname\fP is an array, the
given arguments will replace the initial elements of that array; if no
\fIname\fP is specified, all arrays are printed without their values.
.sp
The behaviour of arguments after \fB\-A\fP \fIname\fP or \fB+A\fP \fIname\fP
depends on whether the option \fBKSH_ARRAYS\fP is set.  If it is not set, all
arguments following \fIname\fP are treated as values for the array,
regardless of their form.  If the option is set, normal option processing
continues at that point; only regular arguments are treated as values for
the array.  This means that
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 set \-A array \-x \-\- foo
.EE
.UNINDENT
.UNINDENT
.sp
sets \fBarray\fP to \fB\-x \-\fP\fB\- foo\fP if \fBKSH_ARRAYS\fP is not set, but sets
the array to \fBfoo\fP and turns on the option \fB\-x\fP if it is set.
.sp
If the \fB\-A\fP flag is not present, but there are arguments beyond the
options, the positional parameters are set.  If the option list (if any)
is terminated by \fB\-\fP\fB\-\fP, and there are no further arguments, the
positional parameters will be unset.
.sp
If no arguments and no \fB\-\fP\fB\-\fP are given, then the names and values of
all parameters are printed on the standard output.  If the only argument is
\fB+\fP, the names of all parameters are printed.
.sp
For historical reasons, \fBset \-\fP is treated as \fBset +xv\fP
and \fBset \-\fP \fIargs\fP as \fBset +xv \-\-\fP \fIargs\fP when in
any other emulation mode than zsh\(aqs native mode.
.UNINDENT
.UNINDENT
.sp
\fBsetcap\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/cap Module\&.
.UNINDENT
.UNINDENT
.sp
\fBsetopt\fP [ {\fB+|\-\fP}:var:\fIoptions\fP | {\fB+|\-}o\fP \fIoption_name\fP ] [ \fB\-m\fP ] [ \fIname\fP ... ]
.INDENT 0.0
.INDENT 3.5
Set the options for the shell.  All options specified either
with flags or by name are set.
.sp
If no arguments are supplied, the names of all options currently set are
printed.  The form is chosen so as to minimize the differences from the
default options for the current emulation (the default emulation being
native \fBzsh\fP, shown as \fB<Z>\fP in
Description of Options).
Options that are on by default for the emulation are
shown with the prefix \fBno\fP only if they are off, while other options are
shown without the prefix \fBno\fP and only if they are on.  In addition to
options changed from the default state by the user, any options activated
automatically by the shell (for example, \fBSHIN_STDIN\fP or \fBINTERACTIVE\fP)
will be shown in the list.  The format is further modified by the option
\fBKSH_OPTION_PRINT\fP, however the rationale for choosing options with
or without the \fBno\fP prefix remains the same in this case.
.sp
If the \fB\-m\fP flag is given the arguments are taken as patterns
(which should be quoted to protect them from filename expansion), and all
options with names matching these patterns are set.
.sp
Note that a bad option name does not cause execution of subsequent shell
code to be aborted; this behaviour is different from that of \fBset
\-o\fP\&.  This is because\(ga\(ga set\(ga\(ga is regarded as a special builtin by the
POSIX standard, but \fBsetopt\fP is not.
.UNINDENT
.UNINDENT
.sp
\fBshift\fP [ \fB\-p\fP ] [ \fIn\fP ] [ \fIname\fP ... ]
.INDENT 0.0
.INDENT 3.5
The positional parameters \fB${\fP\fIn\fP+1\(ga\(ga}\(ga\(ga ... are renamed
to \fB$1\fP ..., where \fIn\fP is an arithmetic expression that
defaults to 1.
If any \fIname\fPs are given then the arrays with these names are
shifted instead of the positional parameters.
.sp
If the option \fB\-p\fP is given arguments are instead removed (popped)
from the end rather than the start of the array.
.UNINDENT
.UNINDENT
.sp
\fBsource\fP \fIfile\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Same as \fB\&.\fP, except that the current directory is always searched and
is always searched first, before directories in \fB$path\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBstat\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/stat Module\&.
.UNINDENT
.UNINDENT
.sp
\fBsuspend\fP [ \fB\-f\fP ]
.INDENT 0.0
.INDENT 3.5
Suspend the execution of the shell (send it a \fBSIGTSTP\fP)
until it receives a \fBSIGCONT\fP\&.
Unless the \fB\-f\fP option is given, this will refuse to suspend a login shell.
.UNINDENT
.UNINDENT
.sp
\fBtest\fP [ \fIarg\fP ... ]
.sp
\fB[\fP [ \fIarg\fP ... ] \fB]\fP
.INDENT 0.0
.INDENT 3.5
Like the system version of \fBtest\fP\&.  Added for compatibility;
use conditional expressions instead (see
Conditional Expressions).
The main differences between the conditional expression syntax and the
\fBtest\fP and \fB[\fP builtins are:  these commands are not handled
syntactically, so for example an empty variable expansion may cause an
argument to be omitted; syntax errors cause status 2 to be returned instead
of a shell error; and arithmetic operators expect integer arguments rather
than arithmetic expressions.
.sp
The command attempts to implement POSIX and its extensions where these
are specified.  Unfortunately there are intrinsic ambiguities in
the syntax; in particular there is no distinction between test operators
and strings that resemble them.  The standard attempts to resolve these
for small numbers of arguments (up to four); for five or more arguments
compatibility cannot be relied on.  Users are urged wherever possible to
use the \fB[[\fP test syntax which does not have these ambiguities.
.UNINDENT
.UNINDENT
.sp
\fBtimes\fP
.INDENT 0.0
.INDENT 3.5
Print the accumulated user and system times for the shell
and for processes run from the shell.
.UNINDENT
.UNINDENT
.sp
\fBtrap\fP [ \fIarg\fP ] [ \fIsig\fP ... ]
.INDENT 0.0
.INDENT 3.5
\fIarg\fP is a series of commands (usually quoted to protect it from
immediate evaluation by the shell) to be read and executed when the shell
receives any of the signals specified by one or more \fIsig\fP args.
Each \fIsig\fP can be given as a number,
or as the name of a signal either with or without the string \fBSIG\fP
in front (e.g. 1, HUP, and SIGHUP are all the same signal).
.sp
If \fIarg\fP is \fB\-\fP, then the specified signals are reset to their
defaults, or, if no \fIsig\fP args are present, all traps are reset.
.sp
If \fIarg\fP is an empty string, then the specified signals
are ignored by the shell (and by the commands it invokes).
.sp
If \fIarg\fP is omitted but one or more \fIsig\fP args are provided (i.e.
the first argument is a valid signal number or name), the effect is the
same as if \fIarg\fP had been specified as \fB\-\fP\&.
.sp
The \fBtrap\fP command with no arguments prints a list of commands
associated with each signal.
.sp
If \fIsig\fP is \fBZERR\fP then \fIarg\fP will be executed
after each command with a nonzero exit status.  \fBERR\fP is an alias
for \fBZERR\fP on systems that have no \fBSIGERR\fP signal (this is the
usual case).
.sp
If \fIsig\fP is \fBDEBUG\fP then \fIarg\fP will be executed
before each command if the option \fBDEBUG_BEFORE_CMD\fP is set
(as it is by default), else after each command.  Here, a \(gacommand\(aq is
what is described as a \(gasublist\(aq in the shell grammar, see
Simple Commands & Pipelines\&.
If \fBDEBUG_BEFORE_CMD\fP is set various additional features are available.
First, it is possible to skip the next command by setting the option
\fBERR_EXIT\fP; see the description of the \fBERR_EXIT\fP option in
\fBzshoptions\fP\&.  Also, the shell parameter
\fBZSH_DEBUG_CMD\fP is set to the string corresponding to the command
to be executed following the trap.  Note that this string is reconstructed
from the internal format and may not be formatted the same way as the
original text.  The parameter is unset after the trap is executed.
.sp
If \fIsig\fP is \fB0\fP or \fBEXIT\fP
and the \fBtrap\fP statement is executed inside the body of a function,
then the command \fIarg\fP is executed after the function completes.
The value of \fB$?\fP at the start of execution is the exit status of the
shell or the return status of the function exiting.
If \fIsig\fP is \fB0\fP or \fBEXIT\fP
and the \fBtrap\fP statement is not executed inside the body of a function,
then the command \fIarg\fP is executed when the shell terminates; the
trap runs before any \fBzshexit\fP hook functions.
.sp
\fBZERR\fP, \fBDEBUG\fP, and \fBEXIT\fP traps are not executed inside other
traps.  \fBZERR\fP and \fBDEBUG\fP traps are kept within subshells, while
other traps are reset.
.sp
Note that traps defined with the \fBtrap\fP builtin are slightly different
from those defined as \fBTRAP\fP\fINAL\fP () { ... }, as the latter have
their own function environment (line numbers, local variables, etc.) while
the former use the environment of the command in which they were called.
For example,
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 trap \(aqprint $LINENO\(aq DEBUG
.EE
.UNINDENT
.UNINDENT
.sp
will print the line number of a command executed after it has run, while
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 TRAPDEBUG() { print $LINENO; }
.EE
.UNINDENT
.UNINDENT
.sp
will always print the number zero.
.sp
Alternative signal names are allowed as described under \fBkill\fP above.
Defining a trap under either name causes any trap under an alternative
name to be removed.  However, it is recommended that for consistency
users stick exclusively to one name or another.
.UNINDENT
.UNINDENT
.sp
\fBtrue\fP [ \fIarg\fP ... ]
.INDENT 0.0
.INDENT 3.5
Do nothing and return an exit status of 0.
.UNINDENT
.UNINDENT
.sp
\fBttyctl\fP [ \fB\-fu\fP ]
.INDENT 0.0
.INDENT 3.5
The \fB\-f\fP option freezes the tty (i.e. terminal or terminal emulator), and
\fB\-u\fP unfreezes it.
When the tty is frozen, no changes made to the tty settings by
external programs will be honored by the shell, except for changes in the
size of the screen; the shell will
simply reset the settings to their previous values as soon as each
command exits or is suspended.  Thus, \fBstty\fP and similar programs have
no effect when the tty is frozen.  Freezing the tty does not cause
the current state to be remembered: instead, it causes future changes
to the state to be blocked.
.sp
Without options it reports whether the terminal is frozen or not.
.sp
Note that, regardless of whether the tty is frozen or not, the
shell needs to change the settings when the line editor starts, so
unfreezing the tty does not guarantee settings made on the
command line are preserved.  Strings of commands run between
editing the command line will see a consistent tty state.
See also the shell variable \fBSTTY\fP for a means of initialising
the tty before running external commands and/or freezing the tty
around a single command.
.UNINDENT
.UNINDENT
.sp
\fBtype\fP [ \fB\-wfpamsS\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Equivalent to \fBwhence \-v\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBtypeset\fP [ {\fB+|\-}AHUaghlmrtux\fP ] [ {\fB+|\-}EFLRZip\fP [ \fIn\fP ] ]
.INDENT 0.0
.INDENT 3.5
[ \fB+\fP ] [ \fIname\fP[\fB=\fP\fIvalue\fP] ... ]
.UNINDENT
.UNINDENT
.sp
\fBtypeset {+|\-}n\fP [ \fB\-g\fP ] [ {\fB+|\-}r\fP ] [ \fIname\fP[\fB=\fP\fIvalue\fP] ... ]
.sp
\fBtypeset\fP \fB\-T\fP [ {\fB+|\-}Uglrux\fP ] [ {\fB+|\-}LRZp\fP [ \fIn\fP ] ]
.INDENT 0.0
.INDENT 3.5
[ \fB+\fP | \fISCALAR\fP[\fB=\fP\fIvalue\fP] \fIarray\fP[\fB=(\fP\fIvalue\fP ...\(ga\(ga)\(ga\(ga] [ \fIsep\fP ] ]
.UNINDENT
.UNINDENT
.sp
\fBtypeset\fP \fB\-f\fP [ {\fB+|\-}TUkmtuz\fP ] [ \fB+\fP ] [ \fIname\fP ... ]
.INDENT 0.0
.INDENT 3.5
Set or display attributes and values for shell parameters.
.sp
Except as noted below for control flags that change the behavior,
a parameter is created for each \fIname\fP that does not already refer
to one.  When inside a function, a new parameter is created for every
\fIname\fP (even those that already exist), and is unset again when the
function completes.  See Local Parameters\&.
The same rules apply to special shell parameters, which
retain their special attributes when made local.
.sp
For each \fIname\fP\fB=\fP\fIvalue\fP assignment, the parameter
\fIname\fP is set to \fIvalue\fP\&.  If the assignment is omitted and \fIname\fP
does \fInot\fP refer to an existing parameter, a new parameter is initialized
to empty string, zero, or empty array (as appropriate), \fIunless\fP the
shell option \fBTYPESET_TO_UNSET\fP is set.  When that option is set,
the parameter attributes are recorded but the parameter remains unset.
.sp
If the shell option \fBTYPESET_SILENT\fP is not set, for each remaining
\fIname\fP that refers to a parameter that is already set, the name and
value of the parameter are printed in the form of an assignment.
Nothing is printed for newly\-created parameters, or when any attribute
flags listed below are given along with the \fIname\fP\&.  Using
\fB+\fP instead of minus to introduce an attribute turns it off.
.sp
If no \fIname\fP is present, the names and values of all parameters are
printed.  In this case the attribute flags restrict the display to only
those parameters that have the specified attributes, and using \fB+\fP
rather than \fB\-\fP to introduce the flag suppresses printing of the values
of parameters when there is no parameter name.
.sp
All forms of the command handle scalar assignment.  Array assignment is
possible if any of the reserved words \fBdeclare\fP, \fBexport\fP, \fBfloat\fP,
\fBinteger\fP, \fBlocal\fP, \fBreadonly\fP or \fBtypeset\fP is matched when the
line is parsed (N.B. not when it is executed).  In this case the arguments
are parsed as assignments, except that the \fB+=\fP syntax and the
\fBGLOB_ASSIGN\fP option are not supported, and scalar values after \fB=\fP
are \fInot\fP split further into words, even if expanded (regardless of the
setting of the \fBKSH_TYPESET\fP option; this option is obsolete).
.sp
Examples of the differences between command and reserved word parsing:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 # Reserved word parsing
 typeset svar=$(echo one word) avar=(several words)
.EE
.UNINDENT
.UNINDENT
.sp
The above creates a scalar parameter \fBsvar\fP and an array
parameter \fBavar\fP as if the assignments had been
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 svar=\(dqone word\(dq
 avar=(several words)
.EE
.UNINDENT
.UNINDENT
.sp
On the other hand:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 # Normal builtin interface
 builtin typeset svar=$(echo two words)
.EE
.UNINDENT
.UNINDENT
.sp
The \fBbuiltin\fP keyword causes the above to use the standard builtin
interface to \fBtypeset\fP in which argument parsing is performed in the same
way as for other commands.  This example creates a scalar \fBsvar\fP
containing the value \fBtwo\fP and another scalar parameter \fBwords\fP with
no value.  An array value in this case would either cause an error or be
treated as an obscure set of glob qualifiers.
.sp
Arbitrary arguments are allowed if they take the form of assignments
after command line expansion; however, these only perform scalar
assignment:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 var=\(aqsvar=val\(aq
 typeset $var
.EE
.UNINDENT
.UNINDENT
.sp
The above sets the scalar parameter \fBsvar\fP to the value \fBval\fP\&.
Parentheses around the value within \fBvar\fP would not cause array
assignment as they will be treated as ordinary characters when \fB$var\fP
is substituted.  Any non\-trivial expansion in the name part of the
assignment causes the argument to be treated in this fashion:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 typeset {var1,var2,var3}=name
.EE
.UNINDENT
.UNINDENT
.sp
The above syntax is valid, and has the expected effect of setting the
three parameters to the same value, but the command line is parsed as
a set of three normal command line arguments to \fBtypeset\fP after
expansion.  Hence it is not possible to assign to multiple arrays by
this means.
.sp
Note that each interface to any of the commands may be disabled
separately.  For example, \fBdisable \-r typeset\fP disables the reserved
word interface to \fBtypeset\fP, exposing the builtin interface, while
\fBdisable typeset\fP disables the builtin.  Note that disabling the
reserved word interface for \fBtypeset\fP may cause problems with the
output of \fBtypeset \-p\fP, which assumes the reserved word interface is
available in order to restore array and associative array values.
.sp
Unlike parameter assignment statements, \fBtypeset\fP\(aqs exit status on an
assignment that involves a command substitution does not reflect the exit
status of the command substitution.  Therefore, to test for an error in
a command substitution, separate the declaration of the parameter from its
initialization:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 # WRONG
 typeset var1=$(exit 1) || echo \(dqTrouble with var1\(dq

 # RIGHT
 typeset var1 && var1=$(exit 1) || echo \(dqTrouble with var1\(dq
.EE
.UNINDENT
.UNINDENT
.sp
To initialize a parameter \fIparam\fP to a command output and mark it readonly,
use \fBtypeset \-r\fP \fIparam\fP or \fBreadonly\fP \fIparam\fP after the parameter
assignment statement.
.sp
The flag \fB\-n\fP creates a \fInamed reference\fP to another parameter.
The second parameter need not exist at the time the reference is
created.  Only the \fB\-H\fP, \fB\-g\fP, and \fB\-r\fP flags may be used in
conjunction with \fB\-n\fP, having their usual meanings.  The \fB\-u\fP
flag is special and may be applied to alter the scope of the reference.
The \fIname\fP so created may not be an array element nor use
a subscript, but the \fIvalue\fP assigned may be any valid parameter
name syntax, even a subscripted array element (including an associative
array element) or an array slice, which is evaluated when the named
reference is expanded.  It is an error for a named reference to refer
to itself, even indirectly through a chain of references.  When \fB\-u\fP
is applied to a named reference, the parameter identified by \fIvalue\fP
is always found in the calling function scope rather than the current
local scope.  In this case, if there is no such parameter in the calling
scope, assignments to the named reference may fail, setting \fB$?\fP to 1.
See Parameter Expansion and
Named References for details of the
behavior of named references.
.sp
Local function scoping rules for \fBtypeset\fP do apply with \fB\-n\fP,
so a declaration within a function persists only until the end of the
function unless \fB\-g \-n\fP is specified, and any local parameter (of
any type) with the same \fIname\fP supplants a named reference from a
surrounding scope.
.sp
A scalar parameter, including an existing named reference, may be
converted to a new named reference by \fBtypeset \-n\fP \fIname\fP, so
the \fB\-p\fP option must be included to display the value of a
specific named reference \fIname\fP\&.
.sp
If no attribute flags are given, and either no \fIname\fP arguments are
present or the flag \fB+m\fP is used, then each parameter name printed is
preceded by a list of the attributes of that parameter (\fBarray\fP,
\fBassociation\fP, \fBexported\fP, \fBfloat\fP, \fBinteger\fP, \fBreadonly\fP,
or \fBundefined\fP for autoloaded parameters not yet loaded).  If \fB+m\fP is
used with attribute flags, and all those flags are introduced with
\fB+\fP, the matching parameter names are printed but their values
are not.
.sp
The following control flags change the behavior of \fBtypeset\fP:
.sp
\fB+\fP
.INDENT 0.0
.INDENT 3.5
If \fB+\fP appears by itself in a separate word as the last option,
then the names of all parameters (functions with \fB\-f\fP) are printed, but
the values (function bodies) are not.  If \fIname\fP arguments appear,
both those names and their values are printed in the form of assignments.
It is an error for any other options to follow \fB+\fP, but the
effect of \fB+\fP is as if all attribute flags which precede it were
given with a \fB+\fP prefix.  For example, \fBtypeset \-U +\fP is
equivalent to \fBtypeset +U\fP and displays the names of all arrays having
the uniqueness attribute, whereas \fBtypeset \-f \-U +\fP displays the
names of all autoloadable functions.  If \fB+\fP is the only option,
then type information (array, readonly, etc.) is also printed for each
parameter, in the same manner as \fBtypeset +m \(dq*\(dq\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-g\fP
.INDENT 0.0
.INDENT 3.5
The \fB\-g\fP (global) means that any resulting parameter will not be
restricted to local scope.  Note that this does not necessarily mean that
the parameter will be global, as the flag will apply to any existing
parameter (even if unset) from an enclosing function.  This flag does not
affect the parameter after creation, hence it has no effect when listing
existing parameters, nor does the flag \fB+g\fP have any effect except in
combination with \fB\-m\fP (see below).
.UNINDENT
.UNINDENT
.sp
\fB\-m\fP
.INDENT 0.0
.INDENT 3.5
If the \fB\-m\fP flag is given the \fIname\fP arguments are taken as patterns
(use quoting to prevent these from being interpreted as file patterns).
With no attribute flags, all parameters (or functions with the \fB\-f\fP
flag) with matching names are printed (the shell option \fBTYPESET_SILENT\fP
is not used in this case).
.sp
If the \fB+g\fP flag is combined with \fB\-m\fP, a new local parameter is
created for every matching parameter that is not already local.  Otherwise
\fB\-m\fP applies all other flags or assignments to the existing parameters,
except that the \fB\-n\fP option cannot create named references in this way.
.sp
Except when assignments are made with \fIname\fP\fB=\fP\fIvalue\fP, using
\fB+m\fP forces the matching parameters and their attributes to be printed,
even inside a function.  Note that \fB\-m\fP is ignored if no patterns are
given, so \fBtypeset \-m\fP displays attributes but \fBtypeset \-a +m\fP
does not.  Ordinary scalar string parameters have no attributes, so for
those \fB+m\fP prints only the names.
.UNINDENT
.UNINDENT
.sp
\fB\-p\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
If the \fB\-p\fP option is given, parameters and values are printed in the
form of a typeset command with an assignment, regardless of other flags
and options.  Note that the \fB\-H\fP flag on parameters is respected; no
value will be shown for these parameters.
.sp
\fB\-p\fP may be followed by an optional integer argument.  Currently
only the value \fB1\fP is supported.  In this case arrays and associative
arrays are printed with newlines between indented elements for
readability.
.sp
The names and values of readonly special parameters
(most of the parameters marked \(ga<S>\(aq in
Parameters Set by the Shell,
except those documented as settable)
are not printed with \fB\-\fP\fBp\fP because to execute those typeset commands
would cause errors.  However, these parameters are printed when they
have been made local to the scope where \fBtypeset \-p\fP is run.
.UNINDENT
.UNINDENT
.sp
\fB\-T\fP [ \fIscalar\fP[\fB=\fP\fIvalue\fP] \fIarray\fP[\fB=(\fP\fIvalue\fP ...\(ga\(ga)\(ga\(ga] [ \fIsep\fP ] ]
.INDENT 0.0
.INDENT 3.5
This flag has a different meaning when used with \fB\-f\fP; see below.
Otherwise the \fB\-T\fP option requires zero, two, or three arguments to be
present.  With no arguments, the list of parameters created in this
fashion is shown.  With two or three arguments, the first two are the name
of a scalar and of an array parameter (in that order) that will be tied
together in the manner of \fB$PATH\fP and \fB$path\fP\&.  The optional third
argument is a single\-character separator which will be used to join the
elements of the array to form the scalar; if absent, a colon is used, as
with \fB$PATH\fP\&.  Only the first character of the separator is significant;
any remaining characters are ignored.  Multibyte characters are not
yet supported.
.sp
Only one of the scalar and array parameters may be assigned an initial
value (the restrictions on assignment forms described above also apply).
.sp
Both the scalar and the array may be manipulated as normal.  If one is
unset, the other will automatically be unset too.  There is no way of
untying the variables without unsetting them, nor of converting the type
of one of them with another \fBtypeset\fP command; \fB+T\fP does not work,
assigning an array to \fIscalar\fP is an error, and assigning a scalar to
\fIarray\fP sets it to be a single\-element array.
.sp
Note that both \fBtypeset \-xT ...\fP  and \fBexport \-T ...\fP work, but
only the scalar will be marked for export.  Setting the value using the
scalar version causes a split on all separators (which cannot be quoted).
It is possible to apply \fB\-T\fP to two previously tied variables but with a
different separator character, in which case the variables remain joined
as before but the separator is changed.
.sp
When an existing scalar is tied to a new array, the value of the scalar
is preserved but no attribute other than export will be preserved.
.UNINDENT
.UNINDENT
.sp
Attribute flags that transform the final value (\fB\-L\fP, \fB\-R\fP, \fB\-Z\fP,
\fB\-l\fP, \fB\-u\fP) are only applied to the expanded value at the point
of a parameter expansion expression using \fB$\fP\&.  They are not applied
when a parameter is retrieved internally by the shell for any purpose.
.sp
The following attribute flags may be specified:
.sp
\fB\-A\fP
.INDENT 0.0
.INDENT 3.5
The names refer to associative array parameters; see
Array Parameters\&.
.UNINDENT
.UNINDENT
.sp
\fB\-L\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Left justify and remove leading blanks from the value when the parameter
is expanded.
If \fIn\fP is nonzero, it defines the width of the field.
If \fIn\fP is zero, the width is determined by the width of the value of
the first assignment.  In the case of numeric parameters, the length of the
complete value assigned to the parameter is used to determine the width,
not the value that would be output.
.sp
The width is the count of characters, which may be multibyte characters
if the \fBMULTIBYTE\fP option is in effect.  Note that the screen
width of the character is not taken into account; if this is required,
use padding with parameter expansion flags
\fB${(ml\fP\fI\&...\fP\fB)\fP\fI\&...\fP\fB}\fP as described in
Parameter Expansion Flags\&.
.sp
When the parameter is expanded, it is filled on the right with
blanks or truncated if necessary to fit the field.
Note truncation can lead to unexpected results with numeric parameters.
Leading zeros are removed if the \fB\-Z\fP flag is also set.
.UNINDENT
.UNINDENT
.sp
\fB\-R\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Similar to \fB\-L\fP, except that right justification is used;
when the parameter is expanded, the field is left filled with
blanks or truncated from the end.  May not be combined with the \fB\-Z\fP
flag.
.UNINDENT
.UNINDENT
.sp
\fB\-U\fP
.INDENT 0.0
.INDENT 3.5
For arrays (but not for associative arrays), keep only the first
occurrence of each duplicated value.  This may also be set for tied
parameters (see \fB\-T\fP) or colon\-separated special parameters like
\fBPATH\fP or \fBFIGNORE\fP, etc.  Note the flag takes effect on assignment,
and the type of the variable being assigned to is determinative; for
variables with shared values it is therefore recommended to set the flag
for all interfaces, e.g. \fBtypeset \-U PATH path\fP\&.
.sp
This flag has a different meaning when used with \fB\-f\fP; see below.
.UNINDENT
.UNINDENT
.sp
\fB\-Z\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Specially handled if set along with the \fB\-L\fP flag.
Otherwise, similar to \fB\-R\fP, except that leading zeros are used for
padding instead of blanks if the first non\-blank character is a digit.
Numeric parameters are specially handled: they are always eligible
for padding with zeroes, and the zeroes are inserted at an appropriate
place in the output.
.UNINDENT
.UNINDENT
.sp
\fB\-a\fP
.INDENT 0.0
.INDENT 3.5
The names refer to array parameters.  An array parameter may be
created this way, but it may be assigned to in the \fBtypeset\fP
statement only if the reserved word form of \fBtypeset\fP is enabled
(as it is by default).  When displaying, both normal and associative
arrays are shown.
.UNINDENT
.UNINDENT
.sp
\fB\-f\fP
.INDENT 0.0
.INDENT 3.5
The names refer to functions rather than parameters.  No assignments
can be made, and the only other valid flags are \fB\-t\fP, \fB\-T\fP, \fB\-k\fP,
\fB\-u\fP, \fB\-U\fP and \fB\-z\fP\&.  The flag \fB\-t\fP turns on execution tracing
for this function; the flag \fB\-T\fP does the same, but turns off tracing
for any named (not anonymous) function called from the present one,
unless that function also
has the \fB\-t\fP or \fB\-T\fP flag.  The \fB\-u\fP and \fB\-U\fP flags cause the
function to be marked for autoloading; \fB\-U\fP also causes alias
expansion to be suppressed when the function is loaded.  See the
description of the \fBautoload\fP builtin for details.
.sp
Note that the builtin \fBfunctions\fP provides the same basic capabilities
as \fBtypeset \-f\fP but gives access to a few extra options; \fBautoload\fP
gives further additional options for the case \fBtypeset \-fu\fP and
\fBtypeset \-fU\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-h\fP
.INDENT 0.0
.INDENT 3.5
Hide: only useful for special parameters (those marked \(ga<S>\(aq in the table in
Parameters Set by the Shell),
and for local parameters with the same name as a special parameter,
though harmless for others.  A special parameter with this attribute will
not retain its special effect when made local.  Thus after \fBtypeset \-h
PATH\fP, a function containing\(ga\(ga typeset PATH\(ga\(ga will create an ordinary
local parameter without the usual behaviour of \fBPATH\fP\&.  Alternatively,
the local parameter may itself be given this attribute; hence inside a
function \fBtypeset \-h PATH\fP creates an ordinary local parameter and the
special \fBPATH\fP parameter is not altered in any way.  It is also possible
to create a local parameter using \fBtypeset +h\fP \fIspecial\fP, where the
local copy of \fIspecial\fP will retain its special properties regardless of
having the \fB\-h\fP attribute.  Global special parameters loaded from shell
modules (for example, those in \fBzsh/mapfile\fP and \fBzsh/parameter\fP) are
automatically given the \fB\-h\fP attribute to avoid name clashes.
.UNINDENT
.UNINDENT
.sp
\fB\-H\fP
.INDENT 0.0
.INDENT 3.5
Hide value: specifies that \fBtypeset\fP will not display the value of the
parameter when listing parameters; the display for such parameters is
always as if the \fB+\fP flag were given, but use of the parameter is
in other respects normal.  This effect does not apply when the parameter is
specified by name or by pattern with the \fB\-m\fP option.  This is on by
default for the parameters in the \fBzsh/parameter\fP and \fBzsh/mapfile\fP
modules.  Note, however, that unlike the \fB\-h\fP flag this is also useful
for non\-special parameters.
.UNINDENT
.UNINDENT
.sp
\fB\-i\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Use an internal integer representation.  If \fIn\fP is nonzero it
defines the output arithmetic base, otherwise it is determined by the
first assignment.  Bases from 2 to 36 inclusive are allowed.
.UNINDENT
.UNINDENT
.sp
\fB\-E\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Use an internal double\-precision floating point representation.  On output
the variable will be converted to scientific notation.  If \fIn\fP is
nonzero it defines the number of significant figures to display; the
default is ten.
.UNINDENT
.UNINDENT
.sp
\fB\-F\fP [ \fIn\fP ]
.INDENT 0.0
.INDENT 3.5
Use an internal double\-precision floating point representation.  On output
the variable will be converted to fixed\-point decimal notation.  If \fIn\fP
is nonzero it defines the number of digits to display after the decimal
point; the default is ten.
.UNINDENT
.UNINDENT
.sp
\fB\-l\fP
.INDENT 0.0
.INDENT 3.5
Convert the result to lower case whenever the parameter is expanded.
The value is \fInot\fP converted when assigned.
.UNINDENT
.UNINDENT
.sp
\fB\-r\fP
.INDENT 0.0
.INDENT 3.5
The given \fIname\fPs are marked readonly.  Note that if \fIname\fP is a
special parameter, the readonly attribute can be turned on, but cannot then
be turned off.
.sp
If the \fBPOSIX_BUILTINS\fP option is set, the readonly attribute is
more restrictive: unset variables can be marked readonly and cannot then
be set; furthermore, the readonly attribute cannot be removed from any
variable.
.sp
It is still possible to change other attributes of the variable though,
some of which like \fB\-U\fP or \fB\-Z\fP would affect the value. More generally,
the readonly attribute should not be relied on as a security mechanism.
.sp
Note that in zsh (like in pdksh but unlike most other shells) it is
still possible to create a local variable of the same name as this is
considered a different variable (though this variable, too, can be marked
readonly). Special variables that have been made readonly retain their value
and readonly attribute when made local.
.UNINDENT
.UNINDENT
.sp
\fB\-t\fP
.INDENT 0.0
.INDENT 3.5
Tags the named parameters.  Tags only exist to flag the parameter for
the user\(aqs own purposes \-\-\- the list of tagged parameters can be queried
using \fBtypeset \-t\fP\&.  Tags have no other use.  Note that the \fB\-t\fP
flag has a different meaning when used with \fB\-f\fP; see above.
.UNINDENT
.UNINDENT
.sp
\fB\-u\fP
.INDENT 0.0
.INDENT 3.5
Convert the result to upper case whenever the parameter is expanded.
The value is \fInot\fP converted when assigned.
This flag has different meanings when used with \fB\-f\fP or \fB\-n\fP; see above.
.UNINDENT
.UNINDENT
.sp
\fB\-x\fP
.INDENT 0.0
.INDENT 3.5
Mark for automatic export to the environment of subsequently
executed commands.  If the option \fBGLOBAL_EXPORT\fP is set, this implies
the option \fB\-g\fP, unless \fB+g\fP is also explicitly given; in other words
the parameter is not made local to the enclosing function.  This is for
compatibility with previous versions of zsh.
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
\fBulimit\fP [ \fB\-HSa\fP ] [ { \fB\-bcdfiklmnpqrsTtvwx\fP | \fB\-N\fP \fIresource\fP } [ \fIlimit\fP ] ... ]
.INDENT 0.0
.INDENT 3.5
Set or display resource limits of the shell and the processes started by
the shell.  The value of \fIlimit\fP can be a number in the unit specified
below or one of the values \fBunlimited\fP, which removes the limit on the
resource, or \fBhard\fP, which uses the current value of the hard limit on
the resource.
.sp
By default, only soft limits are manipulated. If the \fB\-H\fP flag
is given use hard limits instead of soft limits.  If the \fB\-S\fP flag is given
together with the \fB\-H\fP flag set both hard and soft limits.
.sp
If no options are used, the file size limit (\fB\-f\fP) is assumed.
.sp
If \fIlimit\fP is omitted the current value of the specified resources are
printed.  When more than one resource value is printed, the limit name and
unit is printed before each value.
.sp
When looping over multiple resources, the shell will abort immediately if
it detects a badly formed argument.  However, if it fails to set a limit
for some other reason it will continue trying to set the remaining limits.
.sp
Not all the following resources are supported on all systems.  Running
\fBulimit \-a\fP will show which are supported.
.INDENT 0.0
.TP
.B \fB\-a\fP
List all of the current resource limits.
.TP
.B \fB\-b\fP
Socket buffer size in bytes (N.B. not kilobytes)
.TP
.B \fB\-c\fP
512\-byte blocks on the size of core dumps.
.TP
.B \fB\-d\fP
Kilobytes on the size of the data segment.
.TP
.B \fB\-e\fP
Maximum nice value.
.TP
.B \fB\-f\fP
512\-byte blocks on the size of files written.
.TP
.B \fB\-i\fP
The number of pending signals.
.TP
.B \fB\-k\fP
The number of kqueues allocated.
.TP
.B \fB\-l\fP
Kilobytes on the size of locked\-in memory.
.TP
.B \fB\-m\fP
Kilobytes on the size of physical memory.
.TP
.B \fB\-n\fP
Open file descriptors.
.TP
.B \fB\-o\fP
Maximum number of POSIX thread library objects.
.TP
.B \fB\-p\fP
The number of pseudo\-terminals.
.TP
.B \fB\-q\fP
Bytes in POSIX message queues.
.TP
.B \fB\-r\fP
Maximum real time priority.  On some systems where this
is not available, such as NetBSD, this has the same effect as \fB\-T\fP
for compatibility with \fBsh\fP\&.
.TP
.B \fB\-s\fP
Kilobytes on the size of the stack.
.TP
.B \fB\-T\fP
The number of simultaneous threads available to the user.
.TP
.B \fB\-t\fP
CPU seconds to be used.
.TP
.B \fB\-u\fP
The number of processes available to the user.
.TP
.B \fB\-v\fP
Kilobytes on the size of virtual memory.  On some systems this
refers to the limit called \(gaaddress space\(aq.
.TP
.B \fB\-w\fP
Kilobytes on the size of swapped out memory.
.TP
.B \fB\-x\fP
The number of locks on files.
.TP
.B \fB\-y\fP
Maximum size of buffers for pipes/fifos.
.UNINDENT
.sp
A resource may also be specified by integer in the form \fB\-N\fP
\fIresource\fP, where \fIresource\fP corresponds to the integer defined for
the resource by the operating system.  This may be used to set the limits
for resources known to the shell which do not correspond to option letters.
Such limits will be shown by number in the output of \fBulimit \-a\fP\&.
.sp
The number may alternatively be out of the range of limits compiled into
the shell.  The shell will try to read or write the limit anyway, and
will report an error if this fails.
.UNINDENT
.UNINDENT
.sp
\fBumask\fP [ \fB\-S\fP ] [ \fImask\fP ]
.INDENT 0.0
.INDENT 3.5
The umask is set to \fImask\fP\&.  \fImask\fP can be either
an octal number or a symbolic value as described in the \fBchmod(1)\fP man page.
If \fImask\fP is omitted, the current value is printed.  The \fB\-S\fP
option causes the mask to be printed as a symbolic value.  Otherwise,
the mask is printed as an octal number.  Note that in
the symbolic form the permissions you specify are those which are to be
allowed (not denied) to the users specified.
.UNINDENT
.UNINDENT
.sp
\fBunalias\fP [ \fB\-ams\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Removes aliases.  This command works the same as \fBunhash \-a\fP, except that
the \fB\-a\fP option removes all regular or global aliases, or with \fB\-s\fP
all suffix aliases: in this case no \fIname\fP arguments may appear.  The
options \fB\-m\fP (remove by pattern) and \fB\-s\fP without \fB\-a\fP (remove
listed suffix aliases) behave as for \fBunhash \-a\fP\&.  Note that
the meaning of \fB\-a\fP is different between \fBunalias\fP and \fBunhash\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBunfunction\fP
.INDENT 0.0
.INDENT 3.5
Same as \fBunhash \-f\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBunhash\fP [ \fB\-adfms\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Remove the element named \fIname\fP from an internal hash table.  The
default is remove elements from the command hash table.  The \fB\-a\fP
option causes \fBunhash\fP to remove regular or global aliases; note
when removing a global aliases that the argument must be quoted to prevent
it from being expanded before being passed to the command.
The \fB\-s\fP option causes \fBunhash\fP to remove suffix aliases.
The \fB\-f\fP option causes
\fBunhash\fP to remove shell functions.  The \fB\-d\fP options causes
\fBunhash\fP to remove named directories.  If the \fB\-m\fP flag is given
the arguments are taken as patterns (should be quoted) and all elements
of the corresponding hash table with matching names will be removed.
.UNINDENT
.UNINDENT
.sp
\fBunlimit\fP [ \fB\-hs\fP ] \fIresource\fP ...
.INDENT 0.0
.INDENT 3.5
The resource limit for each \fIresource\fP is set to the hard limit.
If the \fB\-h\fP flag is given and the shell has appropriate privileges,
the hard resource limit for each \fIresource\fP is removed.
The resources of the shell process are only changed if the \fB\-s\fP
flag is given.
.sp
The \fBunlimit\fP command is not made available by default when the
shell starts in a mode emulating another shell.  It can be made available
with the command \fBzmodload \-F zsh/rlimits b:unlimit\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBunset\fP [ \fB\-fmv\fP ] [ \fB\-n\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Each named parameter is unset.
Local parameters remain local even if unset; they appear unset within scope,
but the previous value will still reappear when the scope ends.
.sp
Individual elements of associative array parameters may be unset by using
subscript syntax on \fIname\fP, which should be quoted (or the entire command
prefixed with \fBnoglob\fP) to protect the subscript from filename generation.
.sp
If the \fB\-m\fP flag is specified the arguments are taken as patterns (should
be quoted) and all parameters with matching names are unset.  Note that this
cannot be used when unsetting associative array elements, as the subscript
will be treated as part of the pattern.
.sp
The \fB\-v\fP flag specifies that \fIname\fP refers to parameters. This is
the default behaviour.  If the \fB\-n\fP option is supplied, and
\fIname\fP is a a named reference, \fIname\fP will be unset rather than
the variable it references.
.sp
\fBunset \-f\fP is equivalent to \fBunfunction\fP\&.  The \fB\-n\fP option has
no effect with \fB\-f\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBunsetopt\fP [ {\fB+|\-\fP}:var:\fIoptions\fP | {\fB+|\-}o\fP \fIoption_name\fP ] [ \fIname\fP ... ]
.INDENT 0.0
.INDENT 3.5
Unset the options for the shell.  All options specified either
with flags or by name are unset.  If no arguments are supplied,
the names of all options currently unset are printed.
If the \fB\-m\fP flag is given the arguments are taken as patterns
(which should be quoted to preserve them from being interpreted as glob
patterns), and all options with names matching these patterns are unset.
.UNINDENT
.UNINDENT
.sp
\fBvared\fP
.INDENT 0.0
.INDENT 3.5
See Zle Builtins\&.
.UNINDENT
.UNINDENT
.sp
\fBwait\fP [ \fIjob\fP ... ]
.INDENT 0.0
.INDENT 3.5
Wait for the specified jobs or processes.  If \fIjob\fP is not given
then all currently active child processes are waited for.
Each \fIjob\fP can be either a job specification or the process ID
of a job in the job table.
The exit status from this command is that of the job waited for.
If \fIjob\fP represents an unknown job or process ID, a warning is printed
(unless the \fBPOSIX_BUILTINS\fP option is set) and the exit status is 127.
.sp
It is possible to wait for recent processes (specified by process ID,
not by job) that were running in the background even if the process has
exited.  Typically the process ID will be recorded by capturing the
value of the variable \fB$!\fP immediately after the process has been
started.  There is a limit on the number of process IDs remembered by
the shell; this is given by the value of the system configuration
parameter \fBCHILD_MAX\fP\&.  When this limit is reached, older process IDs
are discarded, least recently started processes first.
.sp
Note there is no protection against the process ID wrapping, i.e. if the
wait is not executed soon enough there is a chance the process waited
for is the wrong one.  A conflict implies both process IDs have been
generated by the shell, as other processes are not recorded, and that
the user is potentially interested in both, so this problem is intrinsic
to process IDs.
.UNINDENT
.UNINDENT
.sp
\fBwhence\fP [ \fB\-vcwfpamsS\fP ] [ \fB\-x\fP \fInum\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
For each \fIname\fP, indicate how it would be interpreted if used as a
command name.
.sp
If \fIname\fP is not an alias, built\-in command, external command, shell
function, hashed command, or a reserved word, the exit status shall be
non\-zero, and \-\- if \fB\-v\fP, \fB\-c\fP, or \fB\-w\fP was passed \-\- a message
will be written to standard output.  (This is different from other shells that
write that message to standard error.)
.sp
\fBwhence\fP is most useful when \fIname\fP is only the last path component
of a command, i.e. does not include a \fB/\fP; in particular, pattern
matching only succeeds if just the non\-directory component of the command is
passed.
.sp
\fB\-v\fP
.INDENT 0.0
.INDENT 3.5
Produce a more verbose report.
.UNINDENT
.UNINDENT
.sp
\fB\-c\fP
.INDENT 0.0
.INDENT 3.5
Print the results in a \fBcsh\fP\-like format.
This takes precedence over \fB\-v\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-w\fP
.INDENT 0.0
.INDENT 3.5
For each \fIname\fP, print \fIname\fP\fB:\fP \fIword\fP where \fIword\fP
is one of \fBalias\fP, \fBbuiltin\fP, \fBcommand\fP, \fBfunction\fP,
\fBhashed\fP, \fBreserved\fP or \fBnone\fP, according as \fIname\fP
corresponds to an alias, a built\-in command, an external command, a
shell function, a command defined with the \fBhash\fP builtin, a
reserved word, or is not recognised.  This takes precedence over
\fB\-v\fP and \fB\-c\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-f\fP
.INDENT 0.0
.INDENT 3.5
Causes the contents of a shell function to be
displayed, which would otherwise not happen unless the \fB\-c\fP
flag were used.
.UNINDENT
.UNINDENT
.sp
\fB\-p\fP
.INDENT 0.0
.INDENT 3.5
Do a path search for \fIname\fP
even if it is an alias, reserved word, shell function or builtin.
.UNINDENT
.UNINDENT
.sp
\fB\-a\fP
.INDENT 0.0
.INDENT 3.5
Do a search for all occurrences of \fIname\fP
throughout the command path.
Normally only the first occurrence is printed.
When combined with \fB\-m\fP, only names appearing in the command hash
table are searched, but all occurrences of those names are printed.
.UNINDENT
.UNINDENT
.sp
\fB\-m\fP
.INDENT 0.0
.INDENT 3.5
The arguments are taken as patterns (pattern characters should be
quoted), and the information is displayed for each entry in the command
hash table matching one of these patterns.  The hash table is first
refilled, in case of changes to \fBPATH\fP\&.
.UNINDENT
.UNINDENT
.sp
\fB\-s\fP
.INDENT 0.0
.INDENT 3.5
If a pathname contains symlinks, print the symlink\-free pathname as well.
.UNINDENT
.UNINDENT
.sp
\fB\-S\fP
.INDENT 0.0
.INDENT 3.5
As \fB\-s\fP, but if the pathname had to be resolved by following
multiple symlinks, the intermediate steps are printed, too.  The
symlink resolved at each step might be anywhere in the path.
.UNINDENT
.UNINDENT
.sp
\fB\-x\fP \fInum\fP
.INDENT 0.0
.INDENT 3.5
Expand tabs when outputting shell functions using the \fB\-c\fP option.
This has the same effect as the \fB\-x\fP option to the \fBfunctions\fP
builtin.
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
\fBwhere\fP [ \fB\-wpmsS\fP ] [ \fB\-x\fP \fInum\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Equivalent to \fBwhence \-ca\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBwhich\fP [ \fB\-wpamsS\fP ] [ \fB\-x\fP \fInum\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
Equivalent to \fBwhence \-c\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBzcompile\fP [ \fB\-U\fP ] [ \fB\-z\fP | \fB\-k\fP ] [ \fB\-R\fP | \fB\-M\fP ] \fIfile\fP [ \fIname\fP ... ]
.sp
\fBzcompile\fP \fB\-ca\fP [ \fB\-m\fP ] [ \fB\-R\fP | \fB\-M\fP ] \fIfile\fP [ \fIname\fP ... ]
.sp
\fBzcompile \-t\fP \fIfile\fP [ \fIname\fP ... ]
.INDENT 0.0
.INDENT 3.5
This builtin command can be used to compile functions or scripts,
storing the compiled form in a file, and to examine files containing
the compiled form.  This allows faster autoloading of functions and
sourcing of scripts by avoiding parsing of the text when the files
are read.
.sp
The first form (without the \fB\-c\fP, \fB\-a\fP or \fB\-t\fP options) creates a
compiled file.  If only the \fIfile\fP argument is given, the
output file has the name \fIfile\fP\fB\&.zwc\fP and will be placed in
the same directory as the \fIfile\fP\&.  The shell will load the compiled
file instead of the normal function file when the function
is autoloaded; see Autoloading Functions
for a description of how autoloaded functions are searched.  The
extension \fB\&.zwc\fP stands for \(gazsh word code\(aq.
.sp
If there is at least one \fIname\fP argument, all the named files
are compiled into the output \fIfile\fP given as the first argument.  If
\fIfile\fP does not end in \fB\&.zwc\fP, this extension is automatically
appended.  Files containing multiple compiled functions are called \(gadigest\(aq
files, and are intended to be used as elements of the \fBFPATH/fpath\fP
special array.
.sp
The second form, with the \fB\-c\fP or \fB\-a\fP options, writes the compiled
definitions for all the named functions into \fIfile\fP\&.  For \fB\-c\fP, the
names must be functions currently defined in the shell, not those marked
for autoloading.  Undefined functions that are marked for autoloading
may be written by using the \fB\-a\fP option, in which case the \fBfpath\fP
is searched and the contents of the definition files for those
functions, if found, are compiled into \fIfile\fP\&.  If both \fB\-c\fP and
\fB\-a\fP are given, names of both defined functions and functions marked
for autoloading may be given.  In either case, the functions in files
written with the \fB\-c\fP or \fB\-a\fP option will be autoloaded as if the
\fBKSH_AUTOLOAD\fP option were unset.
.sp
The reason for handling loaded and not\-yet\-loaded functions with
different options is that some definition files for autoloading define
multiple functions, including the function with the same name as the
file, and, at the end, call that function.  In such cases the output of
\fBzcompile \-c\fP does not include the additional functions defined in
the file, and any other initialization code in the file is lost.  Using
\fBzcompile \-a\fP captures all this extra information.
.sp
If the \fB\-m\fP option is combined with \fB\-c\fP or \fB\-a\fP,
the \fIname\fPs are used as patterns and all functions whose names
match one of these patterns will be written. If no \fIname\fP is given,
the definitions of all functions currently defined or marked as
autoloaded will be written.
.sp
Note the second form cannot be used for compiling functions that
include redirections as part of the definition rather than within
the body of the function; for example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 fn1() { { ... } >~/logfile }
.EE
.UNINDENT
.UNINDENT
.sp
can be compiled but
.INDENT 0.0
.INDENT 3.5
.sp
.EX
 fn1() { ... } >~/logfile
.EE
.UNINDENT
.UNINDENT
.sp
cannot.  It is possible to use the first form of \fBzcompile\fP to compile
autoloadable functions that include the full function definition instead
of just the body of the function.
.sp
The third form, with the \fB\-t\fP option, examines an existing
compiled file.  Without further arguments, the names of the original
files compiled into it are listed.  The first line of output shows
the version of the shell which compiled the file and how the file
will be used (i.e. by reading it directly or by mapping it into memory).
With arguments, nothing is output and the return status is set to zero if
definitions for \fIall\fP \fIname\fPs were found in the compiled
file, and non\-zero if the definition for at least one \fIname\fP was not
found.
.sp
Other options:
.sp
\fB\-U\fP
.INDENT 0.0
.INDENT 3.5
Aliases are not expanded when compiling the \fIname\fPd files.
.UNINDENT
.UNINDENT
.sp
\fB\-R\fP
.INDENT 0.0
.INDENT 3.5
When the compiled file is read, its contents are copied into the
shell\(aqs memory, rather than memory\-mapped (see \fB\-M\fP).  This
happens automatically on systems that do not support memory mapping.
.sp
When compiling scripts instead of autoloadable functions, it is
often desirable to use this option; otherwise the whole file, including the
code to define functions which have already been defined, will
remain mapped, consequently wasting memory.
.UNINDENT
.UNINDENT
.sp
\fB\-M\fP
.INDENT 0.0
.INDENT 3.5
The compiled file is mapped into the shell\(aqs memory when read. This
is done in such a way that multiple instances of the shell running
on the same host will share this mapped file.  If neither \fB\-R\fP nor
\fB\-M\fP is given, the \fBzcompile\fP builtin decides what to do based
on the size of the compiled file.
.UNINDENT
.UNINDENT
.sp
\fB\-k\fP
.sp
\fB\-z\fP
.INDENT 0.0
.INDENT 3.5
These options are used when the compiled file contains functions which
are to be autoloaded. If \fB\-z\fP is given, the
function will be autoloaded as if the \fBKSH_AUTOLOAD\fP option is
\fInot\fP set, even if it is set at the time the compiled file is
read, while if the \fB\-k\fP is given, the function will be loaded as if
\fBKSH_AUTOLOAD\fP \fIis\fP set.  These options also take precedence over
any \fB\-k\fP or \fB\-z\fP options specified to the \fBautoload\fP builtin. If
neither of these options is given, the function will be loaded as
determined by the setting of the \fBKSH_AUTOLOAD\fP option at the time
the compiled file is read.
\&.. only:: man
.sp
These options may also appear as many times as necessary between the listed
\fIname\fPs to specify the loading style of all following functions, up to
the next \fB\-k\fP or \fB\-z\fP\&.
.UNINDENT
.UNINDENT
.sp
The created file always contains two versions of the compiled
format, one for big\-endian machines and one for small\-endian
machines.  The upshot of this is that the compiled file is machine
independent and if it is read or mapped, only one half of the file
is actually used (and mapped).
\&.. only:: man
.UNINDENT
.UNINDENT
.sp
\fBzformat\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/zutil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBzftp\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/zftp Module\&.
.UNINDENT
.UNINDENT
.sp
\fBzle\fP
.INDENT 0.0
.INDENT 3.5
See Zle Builtins\&.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP [ \fB\-dL\fP ] [ \fB\-s\fP ] [ ... ]
.sp
\fBzmodload \-F\fP [ \fB\-alLme\fP \fB\-P\fP \fIparam\fP ] \fImodule\fP [ [\fB+\-\fP]:var:\fIfeature\fP ... ]
.sp
\fBzmodload \-e\fP [ \fB\-A\fP ] [ ... ]
.sp
\fBzmodload\fP [ \fB\-a\fP [ \fB\-bcpf\fP [ \fB\-I\fP ] ] ] [ \fB\-iL\fP ] ...
.sp
\fBzmodload\fP \fB\-u\fP [ \fB\-abcdpf\fP [ \fB\-I\fP ] ] [ \fB\-iL\fP ] ...
.sp
\fBzmodload\fP \fB\-A\fP [ \fB\-L\fP ] [ \fImodalias\fP[\fB=\fP\fImodule\fP] ... ]
.sp
\fBzmodload\fP \fB\-R\fP \fImodalias\fP ...
.INDENT 0.0
.INDENT 3.5
Performs operations relating to zsh\(aqs loadable modules.
Loading of modules while the shell is running (\(gadynamical loading\(aq) is not
available on all operating systems, or on all installations on a particular
operating system, although the \fBzmodload\fP command itself is always
available and can be used to manipulate modules built into versions of the
shell executable without dynamical loading.
.sp
Without arguments the names of all currently loaded binary modules are
printed.  The \fB\-L\fP option causes this list to be in the form of a
series of \fBzmodload\fP commands.  Forms with arguments are:
.sp
\fBzmodload\fP [ \fB\-is\fP ] \fIname\fP ...
.sp
\fBzmodload\fP \fB\-u\fP [ \fB\-i\fP ] \fIname\fP ...
.INDENT 0.0
.INDENT 3.5
In the simplest case, \fBzmodload\fP loads a binary module.  The module must
be in a file with a name consisting of the specified \fIname\fP followed by
a standard suffix, usually \fB\&.so\fP (\fB\&.sl\fP on HPUX).
If the module to be loaded is already loaded the duplicate module is
ignored.  If \fBzmodload\fP detects an inconsistency, such as an
invalid module name or circular dependency list, the current code block is
aborted.  If it is available, the module is loaded if necessary, while if it
is not available, non\-zero status is silently returned.  The option
\fB\-i\fP is accepted for compatibility but has no effect.
.sp
The \fIname\fPd module is searched for in the same way a command is, using
\fB$module_path\fP instead of \fB$path\fP\&.  However, the path search is
performed even when the module name contains a \fB/\fP, which it usually does.
There is no way to prevent the path search.
.sp
If the module supports features (see below), \fBzmodload\fP tries to
enable all features when loading a module.  If the module was successfully
loaded but not all features could be enabled, \fBzmodload\fP returns status 2.
.sp
If the option \fB\-s\fP is given, no error is printed if the module was not
available (though other errors indicating a problem with the module are
printed).  The return status indicates if the module was loaded.  This
is appropriate if the caller considers the module optional.
.sp
With \fB\-u\fP, \fBzmodload\fP unloads modules.  The same \fIname\fP
must be given that was given when the module was loaded, but it is not
necessary for the module to exist in the file system.
The \fB\-i\fP option suppresses the error if the module is already
unloaded (or was never loaded).
.sp
Each module has a boot and a cleanup function.  The module
will not be loaded if its boot function fails.  Similarly a module
can only be unloaded if its cleanup function runs successfully.
.UNINDENT
.UNINDENT
.sp
\fBzmodload \-F\fP [ \fB\-almLe\fP \fB\-P\fP \fIparam\fP ] \fImodule\fP [ [\fB+\-\fP]:var:\fIfeature\fP ... ]
.INDENT 0.0
.INDENT 3.5
\fBzmodload \-F\fP allows more selective control over the features provided
by modules.  With no options apart from \fB\-F\fP, the module named
\fImodule\fP is loaded, if it was not already loaded, and the list of
\fIfeature\fPs is set to the required state.  If no
\fIfeature\fPs are specified, the module is loaded, if it was not already
loaded, but the state of features is unchanged.  Each feature
may be preceded by a \fB+\fP to turn the feature on, or \fB\-\fP to turn it
off; the \fB+\fP is assumed if neither character is present.
Any feature not explicitly mentioned is left in its current state;
if the module was not previously loaded this means any such features will
remain disabled.  The return status is zero if all features were
set, 1 if the module failed to load, and 2 if some features could
not be set (for example, a parameter couldn\(aqt be added because there
was a different parameter of the same name) but the module was loaded.
.sp
The standard features are builtins, conditions, parameters and math
functions; these are indicated by the prefix \fBb:\fP, \fBc:\fP
(\fBC:\fP for an infix condition), \fBp:\fP and \fBf:\fP, respectively,
followed by the name that the corresponding feature would have in the
shell.  For example, \fBb:strftime\fP indicates a builtin named
\fBstrftime\fP and \fBp:EPOCHSECONDS\fP indicates a parameter named
\fBEPOCHSECONDS\fP\&.  The module may provide other (\(gaabstract\(aq) features of
its own as indicated by its documentation; these have no prefix.
.sp
With \fB\-l\fP or \fB\-L\fP, features provided by the module are listed.  With
\fB\-l\fP alone, a list of features together with their states is shown, one
feature per line.  With \fB\-L\fP alone, a \fBzmodload \-F\fP command that would
cause enabled features of the module to be turned on is shown.  With
\fB\-lL\fP, a \fBzmodload \-F\fP command that would cause all the features to be
set to their current state is shown.  If one of these combinations is given
with the option \fB\-P\fP \fIparam\fP then the parameter \fIparam\fP is set to an
array of features, either features together with their state or (if
\fB\-L\fP alone is given) enabled features.
.sp
With the option \fB\-L\fP the module name may be omitted; then a list
of all enabled features for all modules providing features is printed
in the form of \fBzmodload \-F\fP commands.  If \fB\-l\fP is also given,
the state of both enabled and disabled features is output in that form.
.sp
A set of features may be provided together with \fB\-l\fP or \fB\-L\fP and a
module name; in that case only the state of those features is
considered.  Each feature may be preceded by \fB+\fP or \fB\-\fP but the
character has no effect.  If no set of features is provided, all
features are considered.
.sp
With \fB\-e\fP, the command first tests that the module is loaded;
if it is not, status 1 is returned.  If the module is loaded,
the list of features given as an argument is examined.  Any feature
given with no prefix is simply tested to see if the module provides it;
any feature given with a prefix \fB+\fP or \fB\-\fP is tested to
see if is provided and in the given state.  If the tests on all features
in the list succeed, status 0 is returned, else status 1.
.sp
With \fB\-m\fP, each entry in the given list of features is taken
as a pattern to be matched against the list of features provided
by the module.  An initial \fB+\fP or \fB\-\fP must be given explicitly.
This may not be combined with the \fB\-a\fP option as autoloads must
be specified explicitly.
.sp
With \fB\-a\fP, the given list of features is marked for autoload from
the specified module, which may not yet be loaded.  An optional \fB+\fP
may appear before the feature name.  If the feature is prefixed with
\fB\-\fP, any existing autoload is removed.  The options \fB\-l\fP and \fB\-L\fP
may be used to list autoloads.  Autoloading is specific to individual
features; when the module is loaded only the requested feature is
enabled.  Autoload requests are preserved if the module is
subsequently unloaded until an explicit \fBzmodload \-Fa\fP \fImodule\fP
\fB\-\fP\fIfeature\fP is issued.  It is not an error to request an autoload
for a feature of a module that is already loaded.
.sp
When the module is loaded each autoload is checked against the features
actually provided by the module; if the feature is not provided the
autoload request is deleted.  A warning message is output; if the
module is being loaded to provide a different feature, and that autoload
is successful, there is no effect on the status of the current command.
If the module is already loaded at the time when \fBzmodload \-Fa\fP is
run, an error message is printed and status 1 returned.
.sp
\fBzmodload \-Fa\fP can be used with the \fB\-l\fP, \fB\-L\fP, \fB\-e\fP and
\fB\-P\fP options for listing and testing the existence of autoloadable
features.  In this case \fB\-l\fP is ignored if \fB\-L\fP is specified.
\fBzmodload \-FaL\fP with no module name lists autoloads for all modules.
.sp
Note that only standard features as described above can be autoloaded;
other features require the module to be loaded before enabling.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-d\fP [ \fB\-L\fP ] [ \fIname\fP ]
.sp
\fBzmodload\fP \fB\-d\fP \fIname\fP \fIdep\fP ...
.sp
\fBzmodload\fP \fB\-ud\fP \fIname\fP [ \fIdep\fP ... ]
.INDENT 0.0
.INDENT 3.5
The \fB\-d\fP option can be used to specify module dependencies.  The modules
named in the second and subsequent arguments will be loaded before the
module named in the first argument.
.sp
With \fB\-d\fP and one argument, all dependencies for that module are listed.
With \fB\-d\fP and no arguments, all module dependencies are listed.  This
listing is by default in a Makefile\-like format.  The \fB\-L\fP option
changes this format to a list of \fBzmodload \-d\fP commands.
.sp
If \fB\-d\fP and \fB\-u\fP are both used, dependencies are removed.  If only one
argument is given, all dependencies for that module are removed.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-ab\fP [ \fB\-L\fP ]
.sp
\fBzmodload\fP \fB\-ab\fP [ \fB\-i\fP ] \fIname\fP [ \fIbuiltin\fP ... ]
.sp
\fBzmodload\fP \fB\-ub\fP [ \fB\-i\fP ] \fIbuiltin\fP ...
.INDENT 0.0
.INDENT 3.5
The \fB\-ab\fP option defines autoloaded builtins.  It defines the specified
\fIbuiltin\fPs.  When any of those builtins is called, the module specified
in the first argument is loaded and all its features are enabled (for
selective control of features use \fBzmodload \-F \-a\fP as described
above).  If only the \fIname\fP is given, one builtin is defined, with
the same name as the module.  \fB\-i\fP suppresses the error if the builtin
is already defined or autoloaded, but not if another builtin of the
same name is already defined.
.sp
With \fB\-ab\fP and no arguments, all autoloaded builtins are listed, with the
module name (if different) shown in parentheses after the builtin name.
The \fB\-L\fP option changes this format to a list of \fBzmodload \-a\fP
commands.
.sp
If \fB\-b\fP is used together with the \fB\-u\fP option, it removes builtins
previously defined with \fB\-ab\fP\&.  This is only possible if the builtin is
not yet loaded.  \fB\-i\fP suppresses the error if the builtin is already
removed (or never existed).
.sp
Autoload requests are retained if the module is subsequently unloaded
until an explicit \fBzmodload \-ub\fP \fIbuiltin\fP is issued.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-ac\fP [ \fB\-IL\fP ]
.sp
\fBzmodload\fP \fB\-ac\fP [ \fB\-iI\fP ] \fIname\fP [ \fIcond\fP ... ]
.sp
\fBzmodload\fP \fB\-uc\fP [ \fB\-iI\fP ] \fIcond\fP ...
.INDENT 0.0
.INDENT 3.5
The \fB\-ac\fP option is used to define autoloaded condition codes. The
\fIcond\fP strings give the names of the conditions defined by the
module. The optional \fB\-I\fP option is used to define infix condition
names. Without this option prefix condition names are defined.
.sp
If given no condition names, all defined names are listed (as a series of
\fBzmodload\fP commands if the \fB\-L\fP option is given).
.sp
The \fB\-uc\fP option removes definitions for autoloaded conditions.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-ap\fP [ \fB\-L\fP ]
.sp
\fBzmodload\fP \fB\-ap\fP [ \fB\-i\fP ] \fIname\fP [ \fIparameter\fP ... ]
.sp
\fBzmodload\fP \fB\-up\fP [ \fB\-i\fP ] \fIparameter\fP ...
.INDENT 0.0
.INDENT 3.5
The \fB\-p\fP option is like the \fB\-b\fP and \fB\-c\fP options, but makes
\fBzmodload\fP work on autoloaded parameters instead.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-af\fP [ \fB\-L\fP ]
.sp
\fBzmodload\fP \fB\-af\fP [ \fB\-i\fP ] \fIname\fP [ \fIfunction\fP ... ]
.sp
\fBzmodload\fP \fB\-uf\fP [ \fB\-i\fP ] \fIfunction\fP ...
.INDENT 0.0
.INDENT 3.5
The \fB\-f\fP option is like the \fB\-b\fP, \fB\-p\fP, and \fB\-c\fP options, but
makes \fBzmodload\fP work on autoloaded math functions instead.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-a\fP [ \fB\-L\fP ]
.sp
\fBzmodload\fP \fB\-a\fP [ \fB\-i\fP ] \fIname\fP [ \fIbuiltin\fP ... ]
.sp
\fBzmodload\fP \fB\-ua\fP [ \fB\-i\fP ] \fIbuiltin\fP ...
.INDENT 0.0
.INDENT 3.5
Equivalent to \fB\-ab\fP and \fB\-ub\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBzmodload \-e\fP [ \fB\-A\fP ] [ \fIstring\fP ... ]
.INDENT 0.0
.INDENT 3.5
The \fB\-e\fP option without arguments lists all loaded modules; if the \fB\-A\fP
option is also given, module aliases corresponding to loaded modules are
also shown.  If arguments are provided, nothing is printed;
the return status is set to zero if all \fIstring\fPs given as arguments
are names of loaded modules and to one if at least on \fIstring\fP is not
the name of a loaded module.  This can be used to test for the
availability of things implemented by modules.  In this case, any
aliases are automatically resolved and the \fB\-A\fP flag is not used.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-A\fP [ \fB\-L\fP ] [ \fImodalias\fP[\fB=\fP\fImodule\fP] ... ]
.INDENT 0.0
.INDENT 3.5
For each argument, if both \fImodalias\fP and \fImodule\fP are given,
define \fImodalias\fP to be an alias for the module \fImodule\fP\&.
If the module \fImodalias\fP is ever subsequently requested, either via a
call to \fBzmodload\fP or implicitly, the shell will attempt to load
\fImodule\fP instead.  If \fImodule\fP is not given, show the definition of
\fImodalias\fP\&.  If no arguments are given, list all defined module aliases.
When listing, if the \fB\-L\fP flag was also given, list the definition as a
\fBzmodload\fP command to recreate the alias.
.sp
The existence of aliases for modules is completely independent of whether
the name resolved is actually loaded as a module: while the alias exists,
loading and unloading the module under any alias has exactly the same
effect as using the resolved name, and does not affect the connection
between the alias and the resolved name which can be removed either by
\fBzmodload \-R\fP or by redefining the alias.  Chains of aliases (i.e. where
the first resolved name is itself an alias) are valid so long as these are
not circular.  As the aliases take the same format as module names, they
may include path separators:  in this case, there is no requirement for any
part of the path named to exist as the alias will be resolved first.  For
example, \fBany/old/alias\fP is always a valid alias.
.sp
Dependencies added to aliased modules are actually added to the resolved
module; these remain if the alias is removed.  It is valid to create an
alias whose name is one of the standard shell modules and which resolves to
a different module.  However, if a module has dependencies, it
will not be possible to use the module name as an alias as the module will
already be marked as a loadable module in its own right.
.sp
Apart from the above, aliases can be used in the \fBzmodload\fP command
anywhere module names are required.  However, aliases will not be
shown in lists of loaded modules with a bare \fBzmodload\fP\&.
.UNINDENT
.UNINDENT
.sp
\fBzmodload\fP \fB\-R\fP \fImodalias\fP ...
.INDENT 0.0
.INDENT 3.5
For each \fImodalias\fP argument that was previously defined as a module
alias via \fBzmodload \-A\fP, delete the alias.  If any was not defined, an
error is caused and the remainder of the line is ignored.
.UNINDENT
.UNINDENT
.sp
Note that \fBzsh\fP makes no distinction between modules that were linked
into the shell and modules that are loaded dynamically. In both cases
this builtin command has to be used to make available the builtins and
other things defined by modules (unless the module is autoloaded on
these definitions). This is true even for systems that don\(aqt support
dynamic loading of modules.
.UNINDENT
.UNINDENT
.sp
\fBzparseopts\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/zutil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBzprof\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/zprof Module\&.
.UNINDENT
.UNINDENT
.sp
\fBzpty\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/zpty Module\&.
.UNINDENT
.UNINDENT
.sp
\fBzregexparse\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/zutil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBzsocket\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/net/socket Module\&.
.UNINDENT
.UNINDENT
.sp
\fBzstyle\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/zutil Module\&.
.UNINDENT
.UNINDENT
.sp
\fBztcp\fP
.INDENT 0.0
.INDENT 3.5
See The zsh/net/tcp Module\&.
.UNINDENT
.UNINDENT
.SH AUTHOR
Zsh Development Group
.SH COPYRIGHT
1990–2026, Zsh Development Group
.\" Generated by docutils manpage writer.
.
----------------------------------------
YODL TO RESTRUCTUREDTEXT FOR ZSH WRITERS
----------------------------------------

Audience: people who already write zsh documentation in Yodl (Doc/*.yo,
Doc/Zsh/*.yo) and need to edit or review the reStructuredText sources
after the all-at-once format cutover.

New developers should use Etc/zsh-development-guide (Documentation)
instead; that document treats rST as the only format of truth and does
not assume Yodl.

General primers (rST itself, not zsh-specific):

* https://docutils.sourceforge.io/docs/user/rst/quickstart.html
* https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html


What changed in one sentence
----------------------------

You used to edit .yo macros; the build ran yodl with zman/ztexi backends.
You now edit .rst; Sphinx builds man, HTML, and Texinfo.  There is no
gradual per-chapter mix: Texinfo and the rest of the manual share one
source tree, so the cutover is wholesale.


Macro map
---------

Yodl                    reStructuredText
-----                   ----------------
em(text)                :emphasis:`text`
bf(text)                :strong:`text`
tt(text)                ``text``
var(name)               :var:`name`
uref(url)               url or `label <url>`_
url(text)(url)          `text <url>`_
manref(name)(sect)      :manpage:`name(sect)`
zmanref(name)           :manpage:`name(1)`
noderef(label)          :ref:`label`
sectref(text)(label)    :ref:`label`  (link text from the target title,
                        or :ref:`text <label>` if you need custom text)
anchor(label) /         .. _label:
  label(label)

chapter(title)          title
                        =======
sect(title)             title
                        -------
subsect(title)          title
                        ^^^^^^^
(and similarly for deeper levels with ~~~~ / '''')

item(term)(defn)        definition list::

                            term
                                defn

xitem(term)             extra term line before the next item()
                        (Sphinx definition list; keep terms short)

example(body)           .. parsed-literal::
                           :class: example

                            body

                        Inline tt/var/em inside body stay real markup
                        (italic metavars in man, <var> in HTML, @var
                        in Texinfo).  Do not use .. code-block:: for
                        manual examples.

indent(body)            indented block / block quote; use explicit
                        inline markup inside (same idea as Yodl indent)

nofill(body)            ::

                            body

                        Turns off filling; explicit markup inside.

ifzman(text) /          .. only:: man
ifnzman(text)           .. only:: not man

ifztexi / ifnztexi      Prefer content that is correct for all outputs.
                        Sphinx `only::` can gate Texinfo builds when
                        that builder is enabled; avoid relying on
                        texi-only alignment hacks (SPACES(), etc.).

startitem/enditem       definition lists (see item above)
startlist/endlist       bullet lists: * item
enumeration             numbered lists: #. item


Same rules, new syntax
----------------------

Quotes vs fonts are still orthogonal.  You still write things like:

    Type ``xyzzy`` to let zsh know you have played ``advent``.
    Saying `plugh` aloud doesn't have much effect, however.

that used to be:

    Type `tt(xyzzy)' to let zsh know you have played tt(advent).
    Saying `plugh' aloud doesn't have much effect, however.


rST gotchas Yodl did not have
-----------------------------

* No whitespace against closing backticks of a literal:
  tt(set ) was fine in Yodl; ``set `` is a Sphinx/docutils error.
  Write ``set`` and leave the space outside.

* No letter glued to the end of emphasis or :var: without an escape:
  var(name)s worked in Yodl; write :var:`name`\s

* Characters that cannot follow an inline end-string (notably `[` and
  `|`) need a backslash or a space after the markup.  Patterns such as
  var(name)[tt(=)var(value)] and {tt(+)|tt(-)}tt(flags) are rewritten
  carefully in rST (often with ``+|-}flags`` collapsed into one
  literal, or `\[` after a role).

* Inside .. parsed-literal::, markup is interpreted.  That is what you
  want for var()/tt() in examples (Yodl put font changes inside
  examples too).  A machine-oriented code listing with no metavars can
  still use a plain :: literal block.


Building (after cutover)
------------------------

* make -f Doc/sphinx.mk venv
* make -f Doc/sphinx.mk html       # distribution HTML (basic, no sidebar)
* make -f Doc/sphinx.mk html-web   # website HTML (-t web, Furo)
* make -f Doc/sphinx.mk man

See also Etc/zsh-development-guide for the canonical new-developer
documentation rules (no Yodl assumed).

Attachment: html.tar.xz
Description: application/compressed



Messages sorted by: Reverse Date, Date, Thread, Author