{
    "mode": "man",
    "parameter": "zshmodules",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/zshmodules/1/json",
    "generated": "2026-07-05T13:04:11Z",
    "sections": {
        "NAME": {
            "content": "zshmodules - zsh loadable modules\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Some  optional  parts  of  zsh  are in modules, separate from the core of the shell.  Each of\nthese modules may be linked in to the shell at build time, or can be dynamically linked while\nthe  shell  is running if the installation supports this feature.  Modules are linked at run‐\ntime with the zmodload command, see zshbuiltins(1).\n\nThe modules that are bundled with the zsh distribution are:\n",
            "subsections": [
                {
                    "name": "zsh/attr",
                    "content": "Builtins for manipulating extended attributes (xattr).\n"
                },
                {
                    "name": "zsh/cap",
                    "content": "Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets.\n"
                },
                {
                    "name": "zsh/clone",
                    "content": "A builtin that can clone a running shell onto another terminal.\n"
                },
                {
                    "name": "zsh/compctl",
                    "content": "The compctl builtin for controlling completion.\n"
                },
                {
                    "name": "zsh/complete",
                    "content": "The basic completion code.\n"
                },
                {
                    "name": "zsh/complist",
                    "content": "Completion listing extensions.\n"
                },
                {
                    "name": "zsh/computil",
                    "content": "A module with utility builtins needed for the shell function based completion system.\n"
                },
                {
                    "name": "zsh/curses",
                    "content": "curses windowing commands\n"
                },
                {
                    "name": "zsh/datetime",
                    "content": "Some date/time commands and parameters.\n"
                },
                {
                    "name": "zsh/db/gdbm",
                    "content": "Builtins for managing associative array parameters tied to GDBM databases.\n"
                },
                {
                    "name": "zsh/deltochar",
                    "content": "A ZLE function duplicating EMACS' zap-to-char.\n"
                },
                {
                    "name": "zsh/example",
                    "content": "An example of how to write a module.\n"
                },
                {
                    "name": "zsh/files",
                    "content": "Some basic file manipulation commands as builtins.\n"
                },
                {
                    "name": "zsh/langinfo",
                    "content": "Interface to locale information.\n"
                },
                {
                    "name": "zsh/mapfile",
                    "content": "Access to external files via a special associative array.\n"
                },
                {
                    "name": "zsh/mathfunc",
                    "content": "Standard scientific functions for use in mathematical evaluations.\n"
                },
                {
                    "name": "zsh/nearcolor",
                    "content": "Map colours to the nearest colour in the available palette.\n"
                },
                {
                    "name": "zsh/newuser",
                    "content": "Arrange for files for new users to be installed.\n"
                },
                {
                    "name": "zsh/parameter",
                    "content": "Access to internal hash tables via special associative arrays.\n"
                },
                {
                    "name": "zsh/pcre",
                    "content": "Interface to the PCRE library.\n"
                },
                {
                    "name": "zsh/param/private",
                    "content": "Builtins for managing private-scoped parameters in function context.\n"
                },
                {
                    "name": "zsh/regex",
                    "content": "Interface to the POSIX regex library.\n"
                },
                {
                    "name": "zsh/sched",
                    "content": "A builtin that provides a timed execution facility within the shell.\n"
                },
                {
                    "name": "zsh/net/socket",
                    "content": "Manipulation of Unix domain sockets\n"
                },
                {
                    "name": "zsh/stat",
                    "content": "A builtin command interface to the stat system call.\n"
                },
                {
                    "name": "zsh/system",
                    "content": "A builtin interface to various low-level system features.\n"
                },
                {
                    "name": "zsh/net/tcp",
                    "content": "Manipulation of TCP sockets\n"
                },
                {
                    "name": "zsh/termcap",
                    "content": "Interface to the termcap database.\n"
                },
                {
                    "name": "zsh/terminfo",
                    "content": "Interface to the terminfo database.\n"
                },
                {
                    "name": "zsh/zftp",
                    "content": "A builtin FTP client.\n"
                },
                {
                    "name": "zsh/zle",
                    "content": "The Zsh Line Editor, including the bindkey and vared builtins.\n"
                },
                {
                    "name": "zsh/zleparameter",
                    "content": "Access to internals of the Zsh Line Editor via parameters.\n"
                },
                {
                    "name": "zsh/zprof",
                    "content": "A module allowing profiling for shell functions.\n"
                },
                {
                    "name": "zsh/zpty",
                    "content": "A builtin for starting a command in a pseudo-terminal.\n"
                },
                {
                    "name": "zsh/zselect",
                    "content": "Block and return when file descriptors are ready.\n"
                },
                {
                    "name": "zsh/zutil",
                    "content": "Some utility builtins, e.g. the one for supporting configuration via styles.\n"
                }
            ]
        },
        "THE ZSH/ATTR MODULE": {
            "content": "The zsh/attr module is used for manipulating extended attributes.  The -h option  causes  all\ncommands  to operate on symbolic links instead of their targets.  The builtins in this module\nare:\n\nzgetattr [ -h ] filename attribute [ parameter ]\nGet the extended attribute attribute from the specified filename. If the optional  ar‐\ngument  parameter  is  given,  the attribute is set on that parameter instead of being\nprinted to stdout.\n\nzsetattr [ -h ] filename attribute value\nSet the extended attribute attribute on the specified filename to value.\n\nzdelattr [ -h ] filename attribute\nRemove the extended attribute attribute from the specified filename.\n\nzlistattr [ -h ] filename [ parameter ]\nList the extended attributes currently set on the specified filename. If the  optional\nargument  parameter  is given, the list of attributes is set on that parameter instead\nof being printed to stdout.\n\nzgetattr and zlistattr allocate memory dynamically.  If the attribute or list  of  attributes\ngrows between the allocation and the call to get them, they return 2.  On all other errors, 1\nis returned.  This allows the calling function to check for this case and retry.\n",
            "subsections": []
        },
        "THE ZSH/CAP MODULE": {
            "content": "The zsh/cap module is used for manipulating POSIX.1e (POSIX.6) capability sets.  If the oper‐\nating  system  does  not  support this interface, the builtins defined by this module will do\nnothing.  The builtins in this module are:\n\ncap [ capabilities ]\nChange the shell's process capability sets to the  specified  capabilities,  otherwise\ndisplay the shell's current capabilities.\n\ngetcap filename ...\nThis  is a built-in implementation of the POSIX standard utility.  It displays the ca‐\npability sets on each specified filename.\n\nsetcap capabilities filename ...\nThis is a built-in implementation of the POSIX standard utility.  It sets the capabil‐\nity sets on each specified filename to the specified capabilities.\n",
            "subsections": []
        },
        "THE ZSH/CLONE MODULE": {
            "content": "The zsh/clone module makes available one builtin command:\n\nclone tty\nCreates a forked instance of the current shell, attached to the specified tty.  In the\nnew shell, the PID, PPID and TTY special parameters are changed appropriately.  $!  is\nset to zero in the new shell, and to the new shell's PID in the original shell.\n\nThe return status of the builtin is zero in both shells if successful, and non-zero on\nerror.\n\nThe target of clone should be an unused terminal, such as an unused virtual console or\na virtual terminal created by\n\nxterm -e sh -c 'trap : INT QUIT TSTP; tty;\nwhile :; do sleep 100000000; done'\n\nSome words of explanation are warranted about this long xterm command line: when doing\nclone on a pseudo-terminal, some other session (\"session\"  meant  as  a  unix  session\ngroup, or SID) is already owning the terminal. Hence the cloned zsh cannot acquire the\npseudo-terminal as a controlling tty. That means two things:\n\n•      the job control signals  will  go  to  the  sh-started-by-xterm  process  group\n(that's  why  we  disable INT QUIT and TSTP with trap; otherwise the while loop\ncould get suspended or killed)\n\n•      the cloned shell will have job control disabled, and the job control keys (con‐\ntrol-C, control-\\ and control-Z) will not work.\n\nThis does not apply when cloning to an unused vc.\n\nCloning  to  a used (and unprepared) terminal will result in two processes reading si‐\nmultaneously from the same  terminal,  with  input  bytes  going  randomly  to  either\nprocess.\n\nclone is mostly useful as a shell built-in replacement for openvt.\n",
            "subsections": []
        },
        "THE ZSH/COMPCTL MODULE": {
            "content": "The  zsh/compctl module makes available two builtin commands. compctl, is the old, deprecated\nway to control completions for ZLE.  See zshcompctl(1).  The other builtin command,  compcall\ncan be used in user-defined completion widgets, see zshcompwid(1).\n",
            "subsections": []
        },
        "THE ZSH/COMPLETE MODULE": {
            "content": "The  zsh/complete  module  makes  available  several  builtin  commands  which can be used in\nuser-defined completion widgets, see zshcompwid(1).\n",
            "subsections": []
        },
        "THE ZSH/COMPLIST MODULE": {
            "content": "The zsh/complist module offers three extensions to completion listings: the ability to  high‐\nlight  matches in such a list, the ability to scroll through long lists and a different style\nof menu completion.\n",
            "subsections": [
                {
                    "name": "Colored completion listings",
                    "content": "Whenever one of the parameters ZLSCOLORS or ZLSCOLOURS is set and the  zsh/complist  module\nis  loaded  or  linked into the shell, completion lists will be colored.  Note, however, that\ncomplist will not automatically be loaded if it is not linked in:  on  systems  with  dynamic\nloading, `zmodload zsh/complist' is required.\n\nThe  parameters  ZLSCOLORS and ZLSCOLOURS describe how matches are highlighted.  To turn on\nhighlighting an empty value suffices, in which case all the default values given  below  will\nbe  used.  The format of the value of these parameters is the same as used by the GNU version\nof the ls command: a colon-separated list of specifications of the  form  `name=value'.   The\nname  may  be  one  of  the following strings, most of which specify file types for which the\nvalue will be used.  The strings and their default values are:\n\nno 0   for normal text (i.e. when displaying something other than a matched file)\n\nfi 0   for regular files\n\ndi 32  for directories\n\nln 36  for symbolic links.  If this has the special value target, symbolic links are derefer‐\nenced and the target file used to determine the display format.\n\npi 31  for named pipes (FIFOs)\n\nso 33  for sockets\n"
                },
                {
                    "name": "bd 44;37",
                    "content": "for block devices\n"
                },
                {
                    "name": "cd 44;37",
                    "content": "for character devices\n\nor none\nfor a symlink to nonexistent file (default is the value defined for ln)\n\nmi none\nfor  a non-existent file (default is the value defined for fi); this code is currently\nnot used\n"
                },
                {
                    "name": "su 37;41",
                    "content": "for files with setuid bit set\n"
                },
                {
                    "name": "sg 30;43",
                    "content": "for files with setgid bit set\n"
                },
                {
                    "name": "tw 30;42",
                    "content": "for world writable directories with sticky bit set\n"
                },
                {
                    "name": "ow 34;43",
                    "content": "for world writable directories without sticky bit set\n\nsa none\nfor files with an associated suffix alias; this is only  tested  after  specific  suf‐\nfixes, as described below\n"
                },
                {
                    "name": "st 37;44",
                    "content": "for directories with sticky bit set but not world writable\n\nex 35  for executable files\n\nlc \\e[ for the left code (see below)\n\nrc m   for the right code\n\ntc 0   for  the character indicating the file type  printed after filenames if the LISTTYPES\noption is set\n\nsp 0   for the spaces printed after matches to align the next column\n\nec none\nfor the end code\n\nApart from these strings, the name may also be an asterisk (`*') followed by any string.  The\nvalue  given  for  such  a string will be used for all files whose name ends with the string.\nThe name may also be an equals sign (`=') followed by a  pattern;  the  EXTENDEDGLOB  option\nwill  be  turned  on for evaluation of the pattern.  The value given for this pattern will be\nused for all matches (not just filenames) whose display string are matched  by  the  pattern.\nDefinitions  for the form with the leading equal sign take precedence over the values defined\nfor file types, which in turn take precedence over the form with the leading  asterisk  (file\nextensions).\n\nThe  leading-equals  form  also allows different parts of the displayed strings to be colored\ndifferently.  For this, the pattern has to use the `(#b)' globbing flag and pairs  of  paren‐\ntheses surrounding the parts of the strings that are to be colored differently.  In this case\nthe value may consist of more than one color code separated by equal signs.  The  first  code\nwill  be  used  for all parts for which no explicit code is specified and the following codes\nwill be used for the parts matched by the sub-patterns  in  parentheses.   For  example,  the\nspecification  `=(#b)(?)*(?)=0=3=7' will be used for all matches which are at least two char‐\nacters long and will use the code `3' for the first character, `7' for the last character and\n`0' for the rest.\n\nAll  three  forms of name may be preceded by a pattern in parentheses.  If this is given, the\nvalue will be used only for matches in groups whose names are matched by the pattern given in\nthe  parentheses.   For  example,  `(g*)m*=43'  highlights  all matches beginning with `m' in\ngroups whose names  begin with `g' using the color code `43'.  In case of the `lc', `rc', and\n`ec' codes, the group pattern is ignored.\n\nNote  also  that  all  patterns  are tried in the order in which they appear in the parameter\nvalue until the first one matches which is then used.  Patterns may be matched  against  com‐\npletions,  descriptions (possibly with spaces appended for padding), or lines consisting of a\ncompletion followed by a description.  For consistent coloring it may  be  necessary  to  use\nmore than one pattern or a pattern with backreferences.\n\nWhen  printing  a  match, the code prints the value of lc, the value for the file-type or the\nlast matching specification with a `*', the value of rc, the string to display for the  match\nitself,  and then the value of ec if that is defined or the values of lc, no, and rc if ec is\nnot defined.\n\nThe default values are ISO 6429 (ANSI) compliant and can be used on vt100  compatible  termi‐\nnals such as xterms.  On monochrome terminals the default values will have no visible effect.\nThe colors function from the contribution can be used to get  associative  arrays  containing\nthe codes for ANSI terminals (see the section `Other Functions' in zshcontrib(1)).  For exam‐\nple, after loading colors, one could use `$color[red]' to get the code for  foreground  color\nred and `$color[bg-green]' for the code for background color green.\n\nIf  the completion system invoked by compinit is used, these parameters should not be set di‐\nrectly because the system controls them itself.  Instead, the  list-colors  style  should  be\nused (see the section `Completion System Configuration' in zshcompsys(1)).\n"
                },
                {
                    "name": "Scrolling in completion listings",
                    "content": "To  enable  scrolling  through  a completion list, the LISTPROMPT parameter must be set.  Its\nvalue will be used as the prompt; if it is the empty string, a default prompt will  be  used.\nThe  value  may  contain escapes of the form `%x'.  It supports the escapes `%B', `%b', `%S',\n`%s', `%U', `%u', `%F', `%f', `%K', `%k' and `%{...%}' used also in shell prompts as well  as\nthree  pairs  of  additional  sequences: a `%l' or `%L' is replaced by the number of the last\nline shown and the total number of lines in the form `number/total'; a `%m' or  `%M'  is  re‐\nplaced  with  the number of the last match shown and the total number of matches; and `%p' or\n`%P' is replaced with `Top', `Bottom' or the position of the first line shown in  percent  of\nthe  total number of lines, respectively.  In each of these cases the form with the uppercase\nletter will be replaced with a string of fixed width, padded to the right with spaces,  while\nthe lowercase form will not be padded.\n\nIf  the  parameter  LISTPROMPT is set, the completion code will not ask if the list should be\nshown.  Instead it immediately starts displaying the list, stopping after the  first  screen‐\nful,  showing the prompt at the bottom, waiting for a keypress after temporarily switching to\nthe listscroll keymap.  Some of the zle functions have  a  special  meaning  while  scrolling\nlists:\n"
                },
                {
                    "name": "send-break",
                    "content": "stops listing discarding the key pressed\n\naccept-line, down-history, down-line-or-history\ndown-line-or-search, vi-down-line-or-history\nscrolls forward one line\n\ncomplete-word, menu-complete, expand-or-complete\nexpand-or-complete-prefix, menu-complete-or-expand\nscrolls forward one screenful\n"
                },
                {
                    "name": "accept-search",
                    "content": "stop listing but take no other action\n\nEvery other character stops listing and immediately processes the key as usual.  Any key that\nis not bound in the listscroll keymap or that is bound to undefined-key is looked up  in  the\nkeymap currently selected.\n\nAs  for the ZLSCOLORS and ZLSCOLOURS parameters, LISTPROMPT should not be set directly when\nusing the shell function based completion system.  Instead, the list-prompt style  should  be\nused.\n"
                },
                {
                    "name": "Menu selection",
                    "content": "The  zsh/complist  module  also offers an alternative style of selecting matches from a list,\ncalled menu selection, which can be used if the shell is set up to return to the last  prompt\nafter showing a completion list (see the ALWAYSLASTPROMPT option in zshoptions(1)).\n\nMenu  selection  can  be  invoked  directly by the widget menu-select defined by this module.\nThis is a standard ZLE widget that can be bound to a key in the usual  way  as  described  in\nzshzle(1).\n\nAlternatively,  the  parameter  MENUSELECT  can be set to an integer, which gives the minimum\nnumber of matches that must be present before menu  selection  is  automatically  turned  on.\nThis  second  method  requires that menu completion be started, either directly from a widget\nsuch as menu-complete, or due to one of the options MENUCOMPLETE or AUTOMENU being set.  If\nMENUSELECT  is set, but is 0, 1 or empty, menu selection will always be started during an am‐\nbiguous menu completion.\n\nWhen using the completion system based on shell functions, the  MENUSELECT  parameter  should\nnot  be  used (like the ZLSCOLORS and ZLSCOLOURS parameters described above).  Instead, the\nmenu style should be used with the select=... keyword.\n\nAfter menu selection is started, the matches will be listed. If there are more  matches  than\nfit on the screen, only the first screenful is shown.  The matches to insert into the command\nline can be selected from this list.  In the list one match is highlighted  using  the  value\nfor ma from the ZLSCOLORS or ZLSCOLOURS parameter.  The default value for this is `7' which\nforces the selected match to be highlighted using standout mode on a vt100-compatible  termi‐\nnal.  If neither ZLSCOLORS nor ZLSCOLOURS is set, the same terminal control sequence as for\nthe `%S' escape in prompts is used.\n\nIf there are more matches than fit on the screen and the parameter  MENUPROMPT  is  set,  its\nvalue  will be shown below the matches.  It supports the same escape sequences as LISTPROMPT,\nbut the number of the match or line shown will be that of the one where the mark  is  placed.\nIf its value is the empty string, a default prompt will be used.\n\nThe  MENUSCROLL  parameter can be used to specify how the list is scrolled.  If the parameter\nis unset, this is done line by line, if it is set to `0' (zero), the list  will  scroll  half\nthe number of lines of the screen.  If the value is positive, it gives the number of lines to\nscroll and if it is negative, the list will be scrolled the number of lines of the screen mi‐\nnus the (absolute) value.\n\nAs  for  the  ZLSCOLORS,  ZLSCOLOURS  and  LISTPROMPT  parameters,  neither  MENUPROMPT nor\nMENUSCROLL should be set directly when using the shell function based completion system.  In‐\nstead, the select-prompt and select-scroll styles should be used.\n\nThe completion code sometimes decides not to show all of the matches in the list.  These hid‐\nden matches are either matches for which the completion function which added them  explicitly\nrequested  that  they not appear in the list (using the -n option of the compadd builtin com‐\nmand) or they are matches which duplicate a string already in the list (because  they  differ\nonly  in things like prefixes or suffixes that are not displayed).  In the list used for menu\nselection, however, even these matches are shown so that it is possible to select  them.   To\nhighlight  such  matches the hi and du capabilities in the ZLSCOLORS and ZLSCOLOURS parame‐\nters are supported for hidden matches of the first and second kind, respectively.\n\nSelecting matches is done by moving the mark around using the zle movement  functions.   When\nnot all matches can be shown on the screen at the same time, the list will scroll up and down\nwhen crossing the top or bottom line.  The following zle functions have special meaning  dur‐\ning menu selection.  Note that the following always perform the same task within the menu se‐\nlection map and cannot be replaced by user defined widgets, nor can the set of  functions  be\nextended:\n\naccept-line, accept-search\naccept  the  current match and leave menu selection (but do not cause the command line\nto be accepted)\n"
                },
                {
                    "name": "send-break",
                    "content": "leaves menu selection and restores the previous contents of the command line\n\nredisplay, clear-screen\nexecute their normal function without leaving menu selection\n\naccept-and-hold, accept-and-menu-complete\naccept the currently inserted match and continue selection allowing to select the next\nmatch to insert into the line\n"
                },
                {
                    "name": "accept-and-infer-next-history",
                    "content": "accepts the current match and then tries completion with menu selection again;  in the\ncase of files this allows one to select a directory and immediately  attempt  to  com‐\nplete  files  in it;  if there are no matches, a message is shown and one can use undo\nto go back to completion on the previous level, every other key leaves menu  selection\n(including the other zle functions which are otherwise special during menu selection)\n\nundo   removes  matches  inserted during the menu selection by one of the three functions be‐\nfore\n\ndown-history, down-line-or-history\nvi-down-line-or-history,  down-line-or-search\nmoves the mark one line down\n\nup-history, up-line-or-history\nvi-up-line-or-history, up-line-or-search\nmoves the mark one line up\n\nforward-char, vi-forward-char\nmoves the mark one column right\n\nbackward-char, vi-backward-char\nmoves the mark one column left\n\nforward-word, vi-forward-word\nvi-forward-word-end, emacs-forward-word\nmoves the mark one screenful down\n\nbackward-word, vi-backward-word, emacs-backward-word\nmoves the mark one screenful up\n\nvi-forward-blank-word, vi-forward-blank-word-end\nmoves the mark to the first line of the next group of matches\n"
                },
                {
                    "name": "vi-backward-blank-word",
                    "content": "moves the mark to the last line of the previous group of matches\n"
                },
                {
                    "name": "beginning-of-history",
                    "content": "moves the mark to the first line\n"
                },
                {
                    "name": "end-of-history",
                    "content": "moves the mark to the last line\n\nbeginning-of-buffer-or-history, beginning-of-line\nbeginning-of-line-hist, vi-beginning-of-line\nmoves the mark to the leftmost column\n\nend-of-buffer-or-history, end-of-line\nend-of-line-hist, vi-end-of-line\nmoves the mark to the rightmost column\n\ncomplete-word, menu-complete, expand-or-complete\nexpand-or-complete-prefix, menu-expand-or-complete\nmoves the mark to the next match\n"
                },
                {
                    "name": "reverse-menu-complete",
                    "content": "moves the mark to the previous match\n"
                },
                {
                    "name": "vi-insert",
                    "content": "this toggles between normal and interactive mode; in interactive mode the  keys  bound\nto  self-insert and self-insert-unmeta insert into the command line as in normal edit‐\ning mode but without leaving menu selection; after each character completion is  tried\nagain  and  the  list  changes to contain only the new matches; the completion widgets\nmake the longest unambiguous string be inserted in the command line and undo and back‐‐\nward-delete-char go back to the previous set of matches\n"
                },
                {
                    "name": "history-incremental-search-forward",
                    "content": ""
                },
                {
                    "name": "history-incremental-search-backward",
                    "content": "this  starts  incremental searches in the list of completions displayed; in this mode,\naccept-line only leaves incremental search, going back to the  normal  menu  selection\nmode\n\nAll  movement  functions  wrap  around at the edges; any other zle function not listed leaves\nmenu selection and executes that function.  It is possible to make widgets in the above  list\ndo  the  same  by  using the form of the widget with a `.' in front.  For example, the widget\n`.accept-line' has the effect of leaving menu selection  and  accepting  the  entire  command\nline.\n\nDuring  this selection the widget uses the keymap menuselect.  Any key that is not defined in\nthis keymap or that is bound to undefined-key is looked up in the keymap currently  selected.\nThis  is used to ensure that the most important keys used during selection (namely the cursor\nkeys, return, and TAB) have sensible defaults.  However, keys in the menuselect keymap can be\nmodified directly using the bindkey builtin command (see zshmodules(1)). For example, to make\nthe return key leave menu selection without accepting the match currently selected one  could\ncall\n\nbindkey -M menuselect '^M' send-break\n\nafter loading the zsh/complist module.\n"
                }
            ]
        },
        "THE ZSH/COMPUTIL MODULE": {
            "content": "The zsh/computil module adds several builtin commands that are used by some of the completion\nfunctions in the completion system based on shell functions (see zshcompsys(1) ).  Except for\ncompquote  these  builtin  commands  are  very specialised and thus not very interesting when\nwriting your own completion functions.  In summary, these builtin commands are:\n",
            "subsections": [
                {
                    "name": "comparguments",
                    "content": "This is used by the arguments function to do the argument and command  line  parsing.\nLike  compdescribe  it has an option -i to do the parsing and initialize some internal\nstate and various options to access the state information to  decide  what  should  be\ncompleted.\n"
                },
                {
                    "name": "compdescribe",
                    "content": "This  is  used  by the describe function to build the displays for the matches and to\nget the strings to add as matches with their options.  On the first call  one  of  the\noptions -i or -I should be supplied as the first argument.  In the first case, display\nstrings without the descriptions will be generated, in the  second  case,  the  string\nused to separate the matches from their descriptions must be given as the second argu‐\nment and the descriptions (if any) will be shown.  All other arguments  are  like  the\ndefinition arguments to describe itself.\n\nOnce  compdescribe  has been called with either the -i or the -I option, it can be re‐\npeatedly called with the -g option and the names of four parameters as its  arguments.\nThis  will  step  through  the  different sets of matches and store the value of comp‐‐\nstate[list] in the first scalar, the options for compadd  in  the  second  array,  the\nmatches  in the third array, and the strings to be displayed in the completion listing\nin the fourth array.  The arrays may then be directly given to compadd to register the\nmatches with the completion code.\n"
                },
                {
                    "name": "compfiles",
                    "content": "Used  by  the  pathfiles  function to optimize complex recursive filename generation\n(globbing).  It does three things.  With the -p and -P options it builds the glob pat‐\nterns  to use, including the paths already handled and trying to optimize the patterns\nwith respect to the prefix and suffix from the line and the match  specification  cur‐\nrently  used.  The -i option does the directory tests for the ignore-parents style and\nthe -r option tests if a component for some of the matches are equal to the string  on\nthe line and removes all other matches if that is true.\n"
                },
                {
                    "name": "compgroups",
                    "content": "Used  by the tags function to implement the internals of the group-order style.  This\nonly takes its arguments as names of completion groups and creates the groups  for  it\n(all  six  types: sorted and unsorted, both without removing duplicates, with removing\nall duplicates and with removing consecutive duplicates).\n\ncompquote [ -p ] names ...\nThere may be reasons to write completion functions that have to add the matches  using\nthe  -Q option to compadd and perform quoting themselves.  Instead of interpreting the\nfirst character of the allquotes key of the compstate special association  and  using\nthe  q flag for parameter expansions, one can use this builtin command.  The arguments\nare the names of scalar or array parameters and the values  of  these  parameters  are\nquoted  as needed for the innermost quoting level.  If the -p option is given, quoting\nis done as if there is some prefix before the values of  the  parameters,  so  that  a\nleading equal sign will not be quoted.\n\nThe return status is non-zero in case of an error and zero otherwise.\n"
                },
                {
                    "name": "comptags",
                    "content": ""
                },
                {
                    "name": "comptry",
                    "content": "These implement the internals of the tags mechanism.\n"
                },
                {
                    "name": "compvalues",
                    "content": "Like comparguments, but for the values function.\n"
                }
            ]
        },
        "THE ZSH/CURSES MODULE": {
            "content": "The zsh/curses module makes available one builtin command and various parameters.\n",
            "subsections": [
                {
                    "name": "Builtin",
                    "content": ""
                },
                {
                    "name": "zcurses init",
                    "content": ""
                },
                {
                    "name": "zcurses end",
                    "content": "zcurses addwin targetwin nlines ncols beginy beginx [ parentwin ]\nzcurses delwin targetwin\nzcurses refresh [ targetwin ... ]\nzcurses touch targetwin ...\nzcurses move targetwin newy newx\nzcurses clear targetwin [ redraw | eol | bot ]\nzcurses position targetwin array\nzcurses char targetwin character\nzcurses string targetwin string\nzcurses border targetwin border\nzcurses attr targetwin [ [+|-]attribute | fgcol/bgcol ] [...]\nzcurses bg targetwin [ [+|-]attribute | fgcol/bgcol | @char ] [...]\nzcurses scroll targetwin [ on | off | [+|-]lines ]\nzcurses input targetwin [ param [ kparam [ mparam ] ] ]\nzcurses mouse [ delay num | [+|-]motion ]\nzcurses timeout targetwin intval\nzcurses querychar targetwin [ param ]\nzcurses resize height width [ endwin | nosave | endwinnosave ]\nManipulate  curses  windows.  All uses of this command should be bracketed by `zcurses\ninit' to initialise use of curses, and `zcurses end' to end it; omitting `zcurses end'\ncan cause the terminal to be in an unwanted state.\n\nThe subcommand addwin creates a window with nlines lines and ncols columns.  Its upper\nleft corner will be placed at row beginy and column beginx of the screen.  targetwin\nis  a  string and refers to the name of a window that is not currently assigned.  Note\nin particular the curses convention that vertical values appear before horizontal val‐\nues.\n\nIf addwin is given an existing window as the final argument, the new window is created\nas a subwindow of parentwin.  This differs from an ordinary new  window  in  that  the\nmemory  of the window contents is shared with the parent's memory.  Subwindows must be\ndeleted before their parent.  Note that the coordinates of subwindows are relative  to\nthe screen, not the parent, as with other windows.\n\nUse  the subcommand delwin to delete a window created with addwin.  Note that end does\nnot implicitly delete windows, and that delwin does not erase the screen image of  the\nwindow.\n\nThe window corresponding to the full visible screen is called stdscr; it always exists\nafter `zcurses init' and cannot be delete with delwin.\n\nThe subcommand refresh will refresh window targetwin; this is necessary  to  make  any\npending changes (such as characters you have prepared for output with char) visible on\nthe screen.  refresh without an argument causes the screen to be cleared and  redrawn.\nIf multiple windows are given, the screen is updated once at the end.\n\nThe subcommand touch marks the targetwins listed as changed.  This is necessary before\nrefreshing windows if a window that was in front of another window (which may be  std‐‐\nscr) is deleted.\n\nThe  subcommand  move  moves the cursor position in targetwin to new coordinates newy\nand newx.  Note that the subcommand string (but not the subcommand char) advances the\ncursor position over the characters added.\n\nThe  subcommand clear erases the contents of targetwin.  One (and no more than one) of\nthree options may be specified.  With the option redraw, in addition the next  refresh\nof  targetwin will cause the screen to be cleared and repainted.  With the option eol,\ntargetwin is only cleared to the end of the current cursor line.  With the option bot,\ntargetwin  is  cleared to the end of the window, i.e everything to the right and below\nthe cursor is cleared.\n\nThe subcommand position writes various positions associated with  targetwin  into  the\narray named array.  These are, in order:\n-      The y and x coordinates of the cursor relative to the top left of targetwin\n-      The y and x coordinates of the top left of targetwin on the screen\n-      The size of targetwin in y and x dimensions.\n\nOutputting characters and strings are achieved by char and string respectively.\n\nTo  draw  a  border  around window targetwin, use border.  Note that the border is not\nsubsequently handled specially:  in other words, the border is simply a set of charac‐\nters  output  at  the edge of the window.  Hence it can be overwritten, can scroll off\nthe window, etc.\n\nThe subcommand attr will set targetwin's  attributes  or  foreground/background  color\npair  for  any  successive  character output.  Each attribute given on the line may be\nprepended by a + to set or a - to unset that attribute; + is assumed if  absent.   The\nattributes supported are blink, bold, dim, reverse, standout, and underline.\n\nEach  fgcol/bgcol  attribute  (to be read as `fgcol on bgcol') sets the foreground\nand background color for character output.  The color default is  sometimes  available\n(in  particular  if  the  library is ncurses), specifying the foreground or background\ncolor with which the terminal started.   The  color  pair  default/default  is  always\navailable.  To  use  more  than  the  8  named colors (red, green, etc.) construct the\nfgcol/bgcol pairs where fgcol and bgcol are decimal integers,  e.g  128/200.   The\nmaximum color value is 254 if the terminal supports 256 colors.\n\nbg  overrides  the  color  and  other attributes of all characters in the window.  Its\nusual use is to set the background initially, but it will overwrite the attributes  of\nany  characters  at  the time when it is called.  In addition to the arguments allowed\nwith attr, an argument @char specifies a character to be shown in otherwise blank  ar‐\neas  of the window.  Owing to limitations of curses this cannot be a multibyte charac‐\nter (use of ASCII characters only is recommended).  As the specified set of attributes\noverride  the existing background, turning attributes off in the arguments is not use‐\nful, though this does not cause an error.\n\nThe subcommand scroll can be used with on or off to enabled or disable scrolling of  a\nwindow  when the cursor would otherwise move below the window due to typing or output.\nIt can also be used with a positive or negative integer to scroll  the  window  up  or\ndown  the  given  number  of lines without changing the current cursor position (which\ntherefore appears to move in the opposite direction relative to the window).   In  the\nsecond case, if scrolling is off it is temporarily turned on to allow the window to be\nscrolled.\n\nThe subcommand input reads a single character from the window without echoing it back.\nIf  param is supplied the character is assigned to the parameter param, else it is as‐\nsigned to the parameter REPLY.\n\nIf both param and kparam are supplied, the key is read in `keypad' mode.  In this mode\nspecial  keys  such  as function keys and arrow keys return the name of the key in the\nparameter kparam.  The key names are the macros defined in the curses.h  or  ncurses.h\nwith the prefix `KEY' removed; see also the description of the parameter zcurseskey‐‐\ncodes below.  Other keys cause a value to be set in param as before.  On a  successful\nreturn only one of param or kparam contains a non-empty string; the other is set to an\nempty string.\n\nIf mparam is also supplied, input attempts to handle mouse input.  This is only avail‐\nable with the ncurses library; mouse handling can be detected by checking for the exit\nstatus of `zcurses mouse' with no arguments.  If a mouse button is clicked (or double-\nor  triple-clicked,  or  pressed  or  released  with  a  configurable delay from being\nclicked) then kparam is set to the string MOUSE, and mparam is set to  an  array  con‐\nsisting of the following elements:\n-      An identifier to discriminate different input devices; this is only rarely use‐\nful.\n-      The x, y and z coordinates of the mouse click relative to the full  screen,  as\nthree  elements in that order (i.e. the y coordinate is, unusually, after the x\ncoordinate).  The z coordinate is only available for a few  unusual  input  de‐\nvices and is otherwise set to zero.\n-      Any events that occurred as separate items; usually there will be just one.  An\nevent consists of PRESSED, RELEASED, CLICKED, DOUBLECLICKED or  TRIPLECLICKED\nfollowed immediately (in the same element) by the number of the button.\n-      If the shift key was pressed, the string SHIFT.\n-      If the control key was pressed, the string CTRL.\n-      If the alt key was pressed, the string ALT.\n\nNot  all mouse events may be passed through to the terminal window; most terminal emu‐\nlators handle some mouse events themselves.  Note that the ncurses manual implies that\nusing  input both with and without mouse handling may cause the mouse cursor to appear\nand disappear.\n\nThe subcommand mouse can be used to configure the use of the mouse.  There is no  win‐\ndow  argument;  mouse  options  are global.  `zcurses mouse' with no arguments returns\nstatus 0 if mouse handling is possible, else status 1.  Otherwise, the possible  argu‐\nments (which may be combined on the same command line) are as follows.  delay num sets\nthe maximum delay in milliseconds between press and release events to be considered as\na click; the value 0 disables click resolution, and the default is one sixth of a sec‐\nond.  motion proceeded by an optional `+' (the default) or - turns on or off reporting\nof  mouse  motion  in  addition  to clicks, presses and releases, which are always re‐\nported.  However, it appears reports for mouse motion are not currently implemented.\n\nThe subcommand timeout specifies a timeout value for input from targetwin.  If  intval\nis  negative,  `zcurses input' waits indefinitely for a character to be typed; this is\nthe default.  If intval is zero, `zcurses input' returns immediately; if there is  ty‐\npeahead  it is returned, else no input is done and status 1 is returned.  If intval is\npositive, `zcurses input' waits intval milliseconds for input and if there is none  at\nthe end of that period returns status 1.\n\nThe  subcommand  querychar  queries the character at the current cursor position.  The\nreturn values are stored in the array named param if supplied, else in the  array  re‐‐\nply.  The first value is the character (which may be a multibyte character if the sys‐\ntem supports them); the second is the color pair in the usual fgcol/bgcol  notation,\nor  0  if  color  is not supported.  Any attributes other than color that apply to the\ncharacter, as set with the subcommand attr, appear as additional elements.\n\nThe subcommand resize resizes stdscr and all windows to given dimensions (windows that\nstick  out  from the new dimensions are resized down). The underlying curses extension\n(resizeterm call) can be unavailable. To verify, zeroes can be used  for  height  and\nwidth.  If  the result of the subcommand is 0, resizeterm is available (2 otherwise).\nTests show that resizing can be normally  accomplished  by  calling  zcurses  end  and\nzcurses  refresh.  The  resize subcommand is provided for versatility. Multiple system\nconfigurations have been checked and zcurses end and zcurses refresh are still  needed\nfor  correct terminal state after resize. To invoke them with resize, use endwin argu‐\nment.  Using nosave argument will cause new terminal state to not be saved  internally\nby zcurses. This is also provided for versatility and should normally be not needed.\n"
                },
                {
                    "name": "Parameters",
                    "content": "ZCURSESCOLORS\nReadonly  integer.  The maximum number of colors the terminal supports.  This value is\ninitialised by the curses library and is not available until the  first  time  zcurses\ninit is run.\n\nZCURSESCOLORPAIRS\nReadonly integer.  The maximum number of color pairs fgcol/bgcol that may be defined\nin `zcurses attr' commands; note this limit applies to all color pairs that have  been\nused  whether  or  not  they  are  currently active.  This value is initialised by the\ncurses library and is not available until the first time zcurses init is run.\n\nzcursesattrs\nReadonly array.  The attributes supported by zsh/curses; available as soon as the mod‐\nule is loaded.\n\nzcursescolors\nReadonly  array.   The colors supported by zsh/curses; available as soon as the module\nis loaded.\n\nzcurseskeycodes\nReadonly array.  The values that may be returned in the second parameter  supplied  to\n`zcurses  input' in the order in which they are defined internally by curses.  Not all\nfunction keys are listed, only F0; curses reserves space for F0 up to F63.\n\nzcurseswindows\nReadonly array.  The current list of windows, i.e. all windows that have been  created\nwith `zcurses addwin' and not removed with `zcurses delwin'.\n"
                }
            ]
        },
        "THE ZSH/DATETIME MODULE": {
            "content": "The zsh/datetime module makes available one builtin command:\n\nstrftime [ -s scalar ] format [ epochtime [ nanoseconds ] ]\nstrftime -r [ -q ] [ -s scalar ] format timestring\nOutput  the  date  in  the  format  specified.   With no epochtime, the current system\ndate/time is used; optionally, epochtime may be used to specify the number of  seconds\nsince  the  epoch,  and  nanoseconds may additionally be used to specify the number of\nnanoseconds past the second (otherwise that number is assumed to  be  0).   See  strf‐\ntime(3)  for details.  The zsh extensions described in the section EXPANSION OF PROMPT\nSEQUENCES in zshmisc(1) are also available.\n\n-q     Run quietly; suppress printing of all error messages described  below.   Errors\nfor invalid epochtime values are always printed.\n\n-r     With  the  option -r (reverse), use format to parse the input string timestring\nand output the number of seconds since the epoch at which  the  time  occurred.\nThe  parsing  is  implemented by the system function strptime; see strptime(3).\nThis means that zsh format extensions are not available, but for reverse lookup\nthey are not required.\n\nIn  most  implementations of strftime any timezone in the timestring is ignored\nand the local timezone declared by the TZ environment variable is  used;  other\nparameters are set to zero if not present.\n\nIf  timestring does not match format the command returns status 1 and prints an\nerror message.   If  timestring  matches  format  but  not  all  characters  in\ntimestring were used, the conversion succeeds but also prints an error message.\n\nIf either of the system functions strptime or mktime is not available, status 2\nis returned and an error message is printed.\n\n-s scalar\nAssign the date string (or epoch time in seconds if -r is given) to scalar  in‐\nstead of printing it.\n\nNote  that depending on the system's declared integral time type, strftime may produce\nincorrect results for  epoch  times  greater  than  2147483647  which  corresponds  to\n2038-01-19 03:14:07 +0000.\n\nThe zsh/datetime module makes available several parameters; all are readonly:\n\nEPOCHREALTIME\nA  floating  point  value representing the number of seconds since the epoch.  The no‐\ntional accuracy is to nanoseconds if the clockgettime call is available  and  to  mi‐\ncroseconds otherwise, but in practice the range of double precision floating point and\nshell scheduling latencies may be significant effects.\n\nEPOCHSECONDS\nAn integer value representing the number of seconds since the epoch.\n",
            "subsections": [
                {
                    "name": "epochtime",
                    "content": "An array value containing the number of seconds since the epoch in the  first  element\nand  the  remainder  of the time since the epoch in nanoseconds in the second element.\nTo ensure the two elements are consistent the array should be copied or otherwise ref‐\nerenced  as a single substitution before the values are used.  The following idiom may\nbe used:\n\nfor secs nsecs in $epochtime; do\n...\ndone\n"
                }
            ]
        },
        "THE ZSH/DB/GDBM MODULE": {
            "content": "The zsh/db/gdbm module is used to create \"tied\" associative arrays that interface to database\nfiles.   If the GDBM interface is not available, the builtins defined by this module will re‐\nport an error.  This module is also intended as a prototype for creating additional  database\ninterfaces, so the ztie builtin may move to a more generic module in the future.\n\nThe builtins in this module are:\n\nztie -d db/gdbm -f filename [ -r ] arrayname\nOpen  the GDBM database identified by filename and, if successful, create the associa‐\ntive array arrayname linked to the file.  To create a local tied array, the  parameter\nmust  first be declared, so commands similar to the following would be executed inside\na function scope:\n\nlocal -A sampledb\nztie -d db/gdbm -f sample.gdbm sampledb\n\nThe -r option opens the database file for reading only, creating a parameter with  the\nreadonly  attribute.   Without  this option, using `ztie' on a file for which the user\ndoes not have write permission is an error.  If writable, the database is opened  syn‐\nchronously so fields changed in arrayname are immediately written to filename.\n\nChanges  to the file modes filename after it has been opened do not alter the state of\narrayname, but `typeset -r arrayname' works as expected.\n\nzuntie [ -u ] arrayname ...\nClose the GDBM database associated with each arrayname and then unset  the  parameter.\nThe -u option forces an unset of parameters made readonly with `ztie -r'.\n\nThis  happens  automatically  if  the parameter is explicitly unset or its local scope\n(function) ends.  Note that a readonly parameter may not be explicitly unset,  so  the\nonly way to unset a global parameter created with `ztie -r' is to use `zuntie -u'.\n\nzgdbmpath parametername\nPut path to database file assigned to parametername into REPLY scalar.\n\nzgdbmtied\nArray holding names of all tied parameters.\n\nThe  fields  of  an associative array tied to GDBM are neither cached nor otherwise stored in\nmemory, they are read from or written to the database on each reference.  Thus, for  example,\nthe values in a readonly array may be changed by a second writer of the same database file.\n",
            "subsections": []
        },
        "THE ZSH/DELTOCHAR MODULE": {
            "content": "The zsh/deltochar module makes available two ZLE functions:\n",
            "subsections": [
                {
                    "name": "delete-to-char",
                    "content": "Read  a character from the keyboard, and delete from the cursor position up to and in‐\ncluding the next (or, with repeat count n, the nth) instance of that character.  Nega‐\ntive repeat counts mean delete backwards.\n"
                },
                {
                    "name": "zap-to-char",
                    "content": "This  behaves  like  delete-to-char, except that the final occurrence of the character\nitself is not deleted.\n"
                }
            ]
        },
        "THE ZSH/EXAMPLE MODULE": {
            "content": "The zsh/example module makes available one builtin command:\n\nexample [ -flags ] [ args ... ]\nDisplays the flags and arguments it is invoked with.\n\nThe purpose of the module is to serve as an example of how to write a module.\n",
            "subsections": []
        },
        "THE ZSH/FILES MODULE": {
            "content": "The zsh/files module makes available some common commands for file manipulation as  builtins;\nthese  commands are probably not needed for many normal situations but can be useful in emer‐\ngency recovery situations with constrained resources.  The commands do not implement all fea‐\ntures now required by relevant standards committees.\n\nFor  all commands, a variant beginning zf is also available and loaded automatically.  Using\nthe features capability of zmodload will let you load only those names you want.   Note  that\nit's possible to load only the builtins with zsh-specific names using the following command:\n\nzmodload -m -F zsh/files b:zf\\*\n\nThe commands loaded by default are:\n\nchgrp [ -hRs ] group filename ...\nChanges  group of files specified.  This is equivalent to chown with a user-spec argu‐\nment of `:group'.\n\nchmod [ -Rs ] mode filename ...\nChanges mode of files specified.\n\nThe specified mode must be in octal.\n\nThe -R option causes chmod to recursively descend into directories, changing the  mode\nof all files in the directory after changing the mode of the directory itself.\n\nThe  -s  option is a zsh extension to chmod functionality.  It enables paranoid behav‐\niour, intended to avoid security problems involving a chmod being tricked into affect‐\ning  files  other than the ones intended.  It will refuse to follow symbolic links, so\nthat (for example) ``chmod 600 /tmp/foo/passwd'' can't accidentally chmod  /etc/passwd\nif  /tmp/foo happens to be a link to /etc.  It will also check where it is after leav‐\ning directories, so that a recursive chmod of a deep directory tree can't end  up  re‐\ncursively chmoding /usr as a result of directories being moved up the tree.\n\nchown [ -hRs ] user-spec filename ...\nChanges ownership and group of files specified.\n\nThe user-spec can be in four forms:\n\nuser   change owner to user; do not change group\nuser:: change owner to user; do not change group\nuser:  change owner to user; change group to user's primary group\nuser:group\nchange owner to user; change group to group\n:group do not change owner; change group to group\n\nIn  each  case, the `:' may instead be a `.'.  The rule is that if there is a `:' then\nthe separator is `:', otherwise if there is a `.' then the separator is `.', otherwise\nthere is no separator.\n\nEach  of  user and group may be either a username (or group name, as appropriate) or a\ndecimal user ID (group ID).  Interpretation as a name takes precedence, if there is an\nall-numeric username (or group name).\n\nIf  the  target is a symbolic link, the -h option causes chown to set the ownership of\nthe link instead of its target.\n\nThe -R option causes chown to recursively descend into directories, changing the  own‐\nership of all files in the directory after changing the ownership of the directory it‐\nself.\n\nThe -s option is a zsh extension to chown functionality.  It enables  paranoid  behav‐\niour, intended to avoid security problems involving a chown being tricked into affect‐\ning files other than the ones intended.  It will refuse to follow symbolic  links,  so\nthat   (for   example)   ``chown  luser  /tmp/foo/passwd''  can't  accidentally  chown\n/etc/passwd if /tmp/foo happens to be a link to /etc.  It will also check where it  is\nafter  leaving  directories,  so that a recursive chown of a deep directory tree can't\nend up recursively chowning /usr as a result of directories being moved up the tree.\n\nln [ -dfhins ] filename dest\nln [ -dfhins ] filename ... dir\nCreates hard (or, with -s, symbolic) links.  In the first form, the specified destina‐\ntion is created, as a link to the specified filename.  In the second form, each of the\nfilenames is taken in turn, and linked to a pathname in the specified  directory  that\nhas the same last pathname component.\n\nNormally,  ln will not attempt to create hard links to directories.  This check can be\noverridden using the -d option.  Typically only the super-user can actually succeed in\ncreating  hard  links  to  directories.   This does not apply to symbolic links in any\ncase.\n\nBy default, existing files cannot be replaced by links.  The -i option causes the user\nto  be queried about replacing existing files.  The -f option causes existing files to\nbe silently deleted, without querying.  -f takes precedence.\n\nThe -h and -n options are identical and both exist for compatibility; either one indi‐\ncates  that  if the target is a symlink then it should not be dereferenced.  Typically\nthis is used in combination with -sf so that if an existing link points to a directory\nthen  it  will  be removed, instead of followed.  If this option is used with multiple\nfilenames and the target is a symbolic link pointing to a directory then the result is\nan error.\n\nmkdir [ -p ] [ -m mode ] dir ...\nCreates  directories.   With  the -p option, non-existing parent directories are first\ncreated if necessary, and there will be no complaint if the directory already  exists.\nThe -m option can be used to specify (in octal) a set of file permissions for the cre‐\nated directories, otherwise mode 777 modified by the current umask (see  umask(2))  is\nused.\n\nmv [ -fi ] filename dest\nmv [ -fi ] filename ... dir\nMoves files.  In the first form, the specified filename is moved to the specified des‐\ntination.  In the second form, each of the filenames is taken in turn, and moved to  a\npathname in the specified directory that has the same last pathname component.\n\nBy  default,  the  user will be queried before replacing any file that the user cannot\nwrite to, but writable files will be silently removed.  The -i option causes the  user\nto  be  queried about replacing any existing files.  The -f option causes any existing\nfiles to be silently deleted, without querying.  -f takes precedence.\n\nNote that this mv will not move files across devices.  Historical versions of mv, when\nactual renaming is impossible, fall back on copying and removing files; if this behav‐\niour is desired, use cp and rm manually.  This may change in a future version.\n\nrm [ -dfiRrs ] filename ...\nRemoves files and directories specified.\n\nNormally, rm will not remove directories (except with the -R or -r options).   The  -d\noption  causes  rm  to  try removing directories with unlink (see unlink(2)), the same\nmethod used for files.  Typically only the super-user can actually succeed in  unlink‐\ning directories in this way.  -d takes precedence over -R and -r.\n\nBy  default,  the  user  will be queried before removing any file that the user cannot\nwrite to, but writable files will be silently removed.  The -i option causes the  user\nto  be  queried  about  removing any files.  The -f option causes files to be silently\ndeleted, without querying, and suppresses all error indications.  -f takes precedence.\n\nThe -R and -r options cause rm to recursively descend into directories,  deleting  all\nfiles  in  the directory before removing the directory with the rmdir system call (see\nrmdir(2)).\n\nThe -s option is a zsh extension to rm functionality.  It enables paranoid  behaviour,\nintended  to avoid common security problems involving a root-run rm being tricked into\nremoving files other than the ones intended.  It will refuse to follow symbolic links,\nso  that (for example) ``rm /tmp/foo/passwd'' can't accidentally remove /etc/passwd if\n/tmp/foo happens to be a link to /etc.  It will also check where it is  after  leaving\ndirectories,  so that a recursive removal of a deep directory tree can't end up recur‐\nsively removing /usr as a result of directories being moved up the tree.\n\nrmdir dir ...\nRemoves empty directories specified.\n\nsync   Calls the system call of the same name (see sync(2)), which flushes dirty  buffers  to\ndisk.  It might return before the I/O has actually been completed.\n",
            "subsections": []
        },
        "THE ZSH/LANGINFO MODULE": {
            "content": "The zsh/langinfo module makes available one parameter:\n",
            "subsections": [
                {
                    "name": "langinfo",
                    "content": "An associative array that maps langinfo elements to their values.\n\nYour implementation may support a number of the following keys:\n\nCODESET,  DTFMT,  DFMT,  TFMT,  RADIXCHAR, THOUSEP, YESEXPR, NOEXPR, CRNCYSTR, AB‐‐\nDAY{1..7}, DAY{1..7}, ABMON{1..12}, MON{1..12}, TFMTAMPM, AMSTR,  PMSTR,  ERA,\nERADFMT, ERADTFMT, ERATFMT, ALTDIGITS\n"
                }
            ]
        },
        "THE ZSH/MAPFILE MODULE": {
            "content": "The zsh/mapfile module provides one special associative array parameter of the same name.\n",
            "subsections": [
                {
                    "name": "mapfile",
                    "content": "This  associative  array  takes as keys the names of files; the resulting value is the\ncontent of the file.  The value is treated identically to any other text coming from a\nparameter.   The  value may also be assigned to, in which case the file in question is\nwritten (whether or not it originally existed); or an element may be unset, which will\ndelete  the file in question.  For example, `vared mapfile[myfile]' works as expected,\nediting the file `myfile'.\n\nWhen the array is accessed as a whole, the keys are the names of files in the  current\ndirectory,  and  the  values  are  empty  (to  save  a huge overhead in memory).  Thus\n${(k)mapfile} has the same effect as the glob operator  *(D),  since  files  beginning\nwith  a dot are not special.  Care must be taken with expressions such as rm ${(k)map‐‐\nfile}, which will delete every file in the current directory without the usual `rm  *'\ntest.\n\nThe parameter mapfile may be made read-only; in that case, files referenced may not be\nwritten or deleted.\n\nA file may conveniently be read into an array as one line per element  with  the  form\n`array=(\"${(f@)mapfile[filename]}\")'.   The double quotes and the `@' are necessary to\nprevent empty lines from being removed.  Note that if the file ends  with  a  newline,\nthe  shell will split on the final newline, generating an additional empty field; this\ncan be suppressed by using `array=(\"${(f@)${mapfile[filename]%$'\\n'}}\")'.\n"
                },
                {
                    "name": "Limitations",
                    "content": "Although reading and writing of the file in question is efficiently handled,  zsh's  internal\nmemory  management may be arbitrarily baroque; however, mapfile is usually very much more ef‐\nficient than anything involving a loop.  Note in particular that the whole  contents  of  the\nfile  will  always reside physically in memory when accessed (possibly multiple times, due to\nstandard parameter substitution operations).  In particular, this means  handling  of  suffi‐\nciently  long  files (greater than the machine's swap space, or than the range of the pointer\ntype) will be incorrect.\n\nNo errors are printed or flagged for non-existent, unreadable, or unwritable  files,  as  the\nparameter mechanism is too low in the shell execution hierarchy to make this convenient.\n\nIt is unfortunate that the mechanism for loading modules does not yet allow the user to spec‐\nify the name of the shell parameter to be given the special behaviour.\n"
                }
            ]
        },
        "THE ZSH/MATHFUNC MODULE": {
            "content": "The zsh/mathfunc module provides standard mathematical  functions  for  use  when  evaluating\nmathematical formulae.  The syntax agrees with normal C and FORTRAN conventions, for example,\n\n(( f = sin(0.3) ))\n\nassigns the sine of 0.3 to the parameter f.\n\nMost functions take floating point arguments and return a floating point value.  However, any\nnecessary conversions from or to integer type will be performed automatically by  the  shell.\nApart  from  atan  with a second argument and the abs, int and float functions, all functions\nbehave as noted in the manual page for the corresponding C function, except  that  any  argu‐\nments  out  of  range for the function in question will be detected by the shell and an error\nreported.\n\nThe following functions take a single floating point  argument:  acos,  acosh,  asin,  asinh,\natan,  atanh,  cbrt,  ceil,  cos,  cosh,  erf,  erfc, exp, expm1, fabs, floor, gamma, j0, j1,\nlgamma, log, log10, log1p, log2, logb, sin, sinh, sqrt, tan, tanh, y0, y1.  The atan function\ncan  optionally  take  a second argument, in which case it behaves like the C function atan2.\nThe ilogb function takes a single floating point argument, but returns an integer.\n\nThe function signgam takes no arguments, and returns an integer, which is the C  variable  of\nthe  same  name, as described in gamma(3).  Note that it is therefore only useful immediately\nafter a call to gamma or lgamma.  Note also that `signgam()' and `signgam' are  distinct  ex‐\npressions.\n\nThe functions min, max, and sum are defined not in this module but in the zmathfunc autoload‐\nable function, described in the section `Mathematical Functions' in zshcontrib(1).\n\nThe following functions take two floating point arguments: copysign, fmod, hypot, nextafter.\n\nThe following take an integer first argument and a floating point second argument: jn, yn.\n\nThe following take a floating point first argument and an  integer  second  argument:  ldexp,\nscalb.\n\nThe  function  abs  does not convert the type of its single argument; it returns the absolute\nvalue of either a floating point number or an integer.  The functions float and  int  convert\ntheir arguments into a floating point or integer value (by truncation) respectively.\n\nNote  that  the  C pow function is available in ordinary math evaluation as the `' operator\nand is not provided here.\n\nThe function rand48 is available if your  system's  mathematical  library  has  the  function\nerand48(3).   It  returns  a pseudo-random floating point number between 0 and 1.  It takes a\nsingle string optional argument.\n\nIf the argument is not present, the random number seed is initialised by three calls  to  the\nrand(3)  function --- this produces the same random numbers as the next three values of $RAN‐‐\nDOM.\n\nIf the argument is present, it gives the name of a scalar parameter where the current  random\nnumber  seed will be stored.  On the first call, the value must contain at least twelve hexa‐\ndecimal digits (the remainder of the string is ignored), or the seed will be  initialised  in\nthe  same manner as for a call to rand48 with no argument.  Subsequent calls to rand48(param)\nwill then maintain the seed in the parameter param as a string of twelve hexadecimal  digits,\nwith  no base signifier.  The random number sequences for different parameters are completely\nindependent, and are also independent from that used by calls to rand48 with no argument.\n\nFor example, consider\n\nprint $(( rand48(seed) ))\nprint $(( rand48() ))\nprint $(( rand48(seed) ))\n\nAssuming $seed does not exist, it will be initialised by the first call.  In the second call,\nthe  default  seed  is  initialised;  note, however, that because of the properties of rand()\nthere is a correlation between the seeds used for the two initialisations, so for more secure\nuses, you should generate your own 12-byte seed.  The third call returns to the same sequence\nof random numbers used in the first call, unaffected by the intervening rand48().\n",
            "subsections": []
        },
        "THE ZSH/NEARCOLOR MODULE": {
            "content": "The zsh/nearcolor module replaces colours specified as hex triplets with the  nearest  colour\nin  the  88  or  256 colour palettes that are widely used by terminal emulators.  By default,\n24-bit true colour escape codes are generated when colours are specified using hex  triplets.\nThese are not supported by all terminals.  The purpose of this module is to make it easier to\ndefine colour preferences in a form that can work across a range of terminal emulators.\n\nAside from the default colour, the ANSI standard for terminal escape codes provides for eight\ncolours.  The  bright attribute brings this to sixteen. These basic colours are commonly used\nin terminal applications due to being widely supported. Expanded 88 and 256  colour  palettes\nare also common and, while the first sixteen colours vary somewhat between terminals and con‐\nfigurations, these add a generally consistent and predictable set of colours.\n\nIn order to use the zsh/nearcolor module, it only needs to be loaded. Thereafter, whenever  a\ncolour  is  specified  using a hex triplet, it will be compared against each of the available\ncolours and the closest will be selected. The first sixteen colours are never matched in this\nprocess due to being unpredictable.\n\nIt  isn't possible to reliably detect support for true colour in the terminal emulator. It is\ntherefore recommended to be selective in loading the zsh/nearcolor module. For  example,  the\nfollowing checks the COLORTERM environment variable:\n\n[[ $COLORTERM = *(24bit|truecolor)* ]] || zmodload zsh/nearcolor\n\nNote that some terminals accept the true color escape codes but map them internally to a more\nlimited palette in a similar manner to the zsh/nearcolor module.\n",
            "subsections": []
        },
        "THE ZSH/NEWUSER MODULE": {
            "content": "The zsh/newuser module is loaded at boot if it is available, the RCS option is set,  and  the\nPRIVILEGED  option  is not set (all three are true by default).  This takes place immediately\nafter commands in the global zshenv file (typically /etc/zsh/zshenv), if any, have been  exe‐\ncuted.   If  the  module is not available it is silently ignored by the shell; the module may\nsafely be removed from $MODULEPATH by the administrator if it is not required.\n\nOn loading, the module tests if any of the start-up files .zshenv, .zprofile, .zshrc or .zlo‐‐\ngin  exist in the directory given by the environment variable ZDOTDIR, or the user's home di‐\nrectory if that is not set.  The test is not performed and the module halts processing if the\nshell was in an emulation mode (i.e. had been invoked as some other shell than zsh).\n\nIf none of the start-up files were found, the module then looks for the file newuser first in\na sitewide directory, usually the parent directory of the site-functions  directory,  and  if\nthat  is not found the module searches in a version-specific directory, usually the parent of\nthe functions directory containing version-specific functions.   (These  directories  can  be\nconfigured when zsh is built using the --enable-site-scriptdir=dir and --enable-scriptdir=dir\nflags  to   configure,   respectively;   the   defaults   are   prefix/share/zsh   and   pre‐\nfix/share/zsh/$ZSHVERSION where the default prefix is /usr/local.)\n\nIf  the file newuser is found, it is then sourced in the same manner as a start-up file.  The\nfile is expected to contain code to install start-up files for the user,  however  any  valid\nshell code will be executed.\n\nThe zsh/newuser module is then unconditionally unloaded.\n\nNote  that  it  is  possible  to achieve exactly the same effect as the zsh/newuser module by\nadding code to /etc/zsh/zshenv.  The module exists simply to allow the shell to make arrange‐\nments  for  new users without the need for intervention by package maintainers and system ad‐\nministrators.\n\nThe script supplied with the module invokes the shell function zsh-newuser-install.  This may\nbe  invoked  directly by the user even if the zsh/newuser module is disabled.  Note, however,\nthat if the module is not installed the function will not be installed either.  The  function\nis documented in the section User Configuration Functions in zshcontrib(1).\n",
            "subsections": []
        },
        "THE ZSH/PARAMETER MODULE": {
            "content": "The  zsh/parameter  module gives access to some of the internal hash tables used by the shell\nby defining some special parameters.\n",
            "subsections": [
                {
                    "name": "options",
                    "content": "The keys for this associative array are the names of the options that can be  set  and\nunset  using  the  setopt  and  unsetopt builtins. The value of each key is either the\nstring on if the option is currently set, or the string off if the  option  is  unset.\nSetting a key to one of these strings is like setting or unsetting the option, respec‐\ntively. Unsetting a key in this array is like setting it to the value off.\n"
                },
                {
                    "name": "commands",
                    "content": "This array gives access to the command hash table. The keys are the names of  external\ncommands,  the  values  are the pathnames of the files that would be executed when the\ncommand would be invoked. Setting a key in this array defines a new entry in this  ta‐\nble  in  the  same  way  as  with the hash builtin. Unsetting a key as in `unset \"com‐‐\nmands[foo]\"' removes the entry for the given key from the command hash table.\n"
                },
                {
                    "name": "functions",
                    "content": "This associative array maps names of enabled functions to their definitions. Setting a\nkey  in  it  is  like  defining a function with the name given by the key and the body\ngiven by the value. Unsetting a key removes the definition for the function  named  by\nthe key.\n\ndisfunctions\nLike functions but for disabled functions.\n\nfunctionssource\nThis  readonly  associative  array  maps names of enabled functions to the name of the\nfile containing the source of the function.\n\nFor an autoloaded function that has already been loaded, or marked for  autoload  with\nan  absolute  path, or that has had its path resolved with `functions -r', this is the\nfile found for autoloading, resolved to an absolute path.\n\nFor a function defined within the body of a script or sourced file, this is  the  name\nof  that  file.   In  this  case, this is the exact path originally used to that file,\nwhich may be a relative path.\n\nFor any other function, including any defined at an interactive prompt or an  autoload\nfunction whose path has not yet been resolved, this is the empty string.  However, the\nhash element is reported as defined just so long as the function is present:  the keys\nto this hash are the same as those to $functions.\n\ndisfunctionssource\nLike functionssource but for disabled functions.\n"
                },
                {
                    "name": "builtins",
                    "content": "This associative array gives information about the builtin commands currently enabled.\nThe keys are the names of the builtin commands and the values are  either  `undefined'\nfor  builtin  commands  that  will automatically be loaded from a module if invoked or\n`defined' for builtin commands that are already loaded.\n\ndisbuiltins\nLike builtins but for disabled builtin commands.\n"
                },
                {
                    "name": "reswords",
                    "content": "This array contains the enabled reserved words.\n\ndisreswords\nLike reswords but for disabled reserved words.\n"
                },
                {
                    "name": "patchars",
                    "content": "This array contains the enabled pattern characters.\n\ndispatchars\nLike patchars but for disabled pattern characters.\n"
                },
                {
                    "name": "aliases",
                    "content": "This maps the names of the regular aliases currently enabled to their expansions.\n\ndisaliases\nLike aliases but for disabled regular aliases.\n"
                },
                {
                    "name": "galiases",
                    "content": "Like aliases, but for global aliases.\n\ndisgaliases\nLike galiases but for disabled global aliases.\n"
                },
                {
                    "name": "saliases",
                    "content": "Like raliases, but for suffix aliases.\n\ndissaliases\nLike saliases but for disabled suffix aliases.\n"
                },
                {
                    "name": "parameters",
                    "content": "The keys in this associative array are the names of the parameters currently  defined.\nThe  values  are strings describing the type of the parameter, in the same format used\nby the t parameter flag, see zshexpn(1) .  Setting or unsetting keys in this array  is\nnot possible.\n"
                },
                {
                    "name": "modules",
                    "content": "An  associative  array giving information about modules. The keys are the names of the\nmodules loaded, registered to be autoloaded, or aliased. The value  says  which  state\nthe  named  module  is  in  and  is  one  of  the  strings  `loaded', `autoloaded', or\n`alias:name', where name is the name the module is aliased to.\n\nSetting or unsetting keys in this array is not possible.\n"
                },
                {
                    "name": "dirstack",
                    "content": "A normal array holding the elements of the directory stack. Note that  the  output  of\nthe dirs builtin command includes one more directory, the current working directory.\n"
                },
                {
                    "name": "history",
                    "content": "This associative array maps history event numbers to the full history lines.  Although\nit is presented as an associative array, the array of all  values  (${history[@]})  is\nguaranteed  to be returned in order from most recent to oldest history event, that is,\nby decreasing history event number.\n"
                },
                {
                    "name": "historywords",
                    "content": "A special array containing the words stored in the history.  These also appear in most\nto least recent order.\n"
                },
                {
                    "name": "jobdirs",
                    "content": "This  associative  array  maps  job  numbers to the directories from which the job was\nstarted (which may not be the current directory of the job).\n\nThe keys of the associative arrays are usually valid job numbers, and  these  are  the\nvalues  output  with,  for  example, ${(k)jobdirs}.  Non-numeric job references may be\nused when looking up a value; for example, ${jobdirs[%+]} refers to the current job.\n"
                },
                {
                    "name": "jobtexts",
                    "content": "This associative array maps job numbers to the texts of the command  lines  that  were\nused to start the jobs.\n\nHandling of the keys of the associative array is as described for jobdirs above.\n"
                },
                {
                    "name": "jobstates",
                    "content": "This associative array gives information about the states of the jobs currently known.\nThe  keys  are  the  job  numbers  and  the   values   are   strings   of   the   form\n`job-state:mark:pid=state...'.  The  job-state  gives  the state the whole job is cur‐\nrently in, one of `running', `suspended', or `done'. The mark is `+' for  the  current\njob,  `-'  for  the  previous  job  and  empty  otherwise.  This  is  followed  by one\n`:pid=state' for every process in the job. The pids are, of course,  the  process  IDs\nand the state describes the state of that process.\n\nHandling of the keys of the associative array is as described for jobdirs above.\n"
                },
                {
                    "name": "nameddirs",
                    "content": "This associative array maps the names of named directories to the pathnames they stand\nfor.\n"
                },
                {
                    "name": "userdirs",
                    "content": "This associative array maps user names to the pathnames of their home directories.\n"
                },
                {
                    "name": "usergroups",
                    "content": "This associative array maps names of system groups of which the current user is a mem‐\nber  to  the corresponding group identifiers.  The contents are the same as the groups\noutput by the id command.\n"
                },
                {
                    "name": "funcfiletrace",
                    "content": "This array contains the absolute line numbers and corresponding  file  names  for  the\npoint  where  the current function, sourced file, or (if EVALLINENO is set) eval com‐\nmand was called.  The array is of the same length as  funcsourcetrace  and  functrace,\nbut  differs from funcsourcetrace in that the line and file are the point of call, not\nthe point of definition, and differs from functrace in that all  values  are  absolute\nline numbers in files, rather than relative to the start of a function, if any.\n"
                },
                {
                    "name": "funcsourcetrace",
                    "content": "This array contains the file names and line numbers of the points where the functions,\nsourced files, and (if EVALLINENO is set) eval commands currently being executed were\ndefined.   The line number is the line where the `function name' or `name ()' started.\nIn the case of an autoloaded function  the line number is reported as zero.  The  for‐\nmat of each element is filename:lineno.\n\nFor  functions autoloaded from a file in native zsh format, where only the body of the\nfunction occurs in the file, or for files that have been executed by the source or `.'\nbuiltins,  the  trace information is shown as filename:0, since the entire file is the\ndefinition.  The source file name is resolved to an absolute path when the function is\nloaded or the path to it otherwise resolved.\n\nMost users will be interested in the information in the funcfiletrace array instead.\n"
                },
                {
                    "name": "funcstack",
                    "content": "This  array contains the names of the functions, sourced files, and (if EVALLINENO is\nset) eval commands. currently being executed. The first element is  the  name  of  the\nfunction using the parameter.\n\nThe  standard  shell array zshevalcontext can be used to determine the type of shell\nconstruct being executed at each depth: note, however, that is in the opposite  order,\nwith  the most recent item last, and it is more detailed, for example including an en‐\ntry for toplevel, the main shell code being executed either interactively  or  from  a\nscript, which is not present in $funcstack.\n"
                },
                {
                    "name": "functrace",
                    "content": "This  array  contains  the  names and line numbers of the callers corresponding to the\nfunctions currently being executed.  The format of each element is name:lineno.  Call‐\ners  are also shown for sourced files; the caller is the point where the source or `.'\ncommand was executed.\n"
                }
            ]
        },
        "THE ZSH/PCRE MODULE": {
            "content": "The zsh/pcre module makes some commands available as builtins:\n\npcrecompile [ -aimxs ] PCRE\nCompiles a perl-compatible regular expression.\n\nOption -a will force the pattern to be anchored.  Option -i will compile a case-insen‐\nsitive  pattern.   Option  -m will compile a multi-line pattern; that is, ^ and $ will\nmatch newlines within the pattern.   Option  -x  will  compile  an  extended  pattern,\nwherein  whitespace and # comments are ignored.  Option -s makes the dot metacharacter\nmatch all characters, including those that indicate newline.\n\npcrestudy\nStudies the previously-compiled PCRE which may result in faster matching.\n\npcrematch [ -v var ] [ -a arr ] [ -n offset ] [ -b ] string\nReturns successfully if string matches the previously-compiled PCRE.\n\nUpon successful match, if  the  expression  captures  substrings  within  parentheses,\npcrematch  will  set  the  array  match  to those substrings, unless the -a option is\ngiven, in which case it will set the array arr.  Similarly, the variable MATCH will be\nset  to  the  entire  matched portion of the string, unless the -v option is given, in\nwhich case the variable var will be set.  No variables are altered if there is no suc‐\ncessful match.  A -n option starts searching for a match from the byte offset position\nin string.  If the -b option is given, the variable ZPCREOP will be set to an  offset\npair  string,  representing  the  byte  offset positions of the entire matched portion\nwithin the string.  For example, a ZPCREOP set to \"32 45\" indicates that the  matched\nportion  began on byte offset 32 and ended on byte offset 44.  Here, byte offset posi‐\ntion 45 is the position directly after the matched portion.  Keep  in  mind  that  the\nbyte  position isn't necessarily the same as the character position when UTF-8 charac‐\nters are involved.  Consequently, the byte offset positions are only to be  relied  on\nin  the context of using them for subsequent searches on string, using an offset posi‐\ntion as an argument to the -n option.  This is mostly used to implement the \"find  all\nnon-overlapping matches\" functionality.\n\nA simple example of \"find all non-overlapping matches\":\n\nstring=\"The following zip codes: 78884 90210 99513\"\npcrecompile -m \"\\d{5}\"\naccum=()\npcrematch -b -- $string\nwhile [[ $? -eq 0 ]] do\nb=($=ZPCREOP)\naccum+=$MATCH\npcrematch -b -n $b[2] -- $string\ndone\nprint -l $accum\n\nThe zsh/pcre module makes available the following test condition:\n\nexpr -pcre-match pcre\nMatches a string against a perl-compatible regular expression.\n\nFor example,\n\n[[ \"$text\" -pcre-match ^d+$ ]] &&\nprint text variable contains only \"d's\".\n\nIf  the  REMATCHPCRE option is set, the =~ operator is equivalent to -pcre-match, and\nthe NOCASEMATCH option may be used.  Note that NOCASEMATCH never  applies  to  the\npcrematch builtin, instead use the -i switch of pcrecompile.\n",
            "subsections": []
        },
        "THE ZSH/PARAM/PRIVATE MODULE": {
            "content": "The  zsh/param/private module is used to create parameters whose scope is limited to the cur‐\nrent function body, and not to other functions called by the current function.\n\nThis module provides a single autoloaded builtin:\n\nprivate [ {+|-}AHUahlprtux ] [ {+|-}EFLRZi [ n ] ] [ name[=value] ... ]\nThe private builtin accepts  all  the  same  options  and  arguments  as  local  (zsh‐\nbuiltins(1)) except for the `-T' option.  Tied parameters may not be made private.\n\nIf  used at the top level (outside a function scope), private creates a normal parame‐\nter in the same manner as declare or typeset.  A warning  about  this  is  printed  if\nWARNCREATEGLOBAL is set (zshoptions(1)).  Used inside a function scope, private cre‐\nates a local parameter similar to one declared with local, except having special prop‐\nerties noted below.\n\nSpecial  parameters  which  expose  or  manipulate internal shell state, such as ARGC,\nargv, COLUMNS, LINES, UID, EUID, IFS, PROMPT, RANDOM, SECONDS, etc.,  cannot  be  made\nprivate  unless  the `-h' option is used to hide the special meaning of the parameter.\nThis may change in the future.\n\nAs with other typeset equivalents, private is both a builtin and a reserved word,  so  arrays\nmay  be  assigned with parenthesized word list name=(value...) syntax.  However, the reserved\nword `private' is not available until zsh/param/private is loaded, so care must be taken with\norder of execution and parsing for function definitions which use private.  To compensate for\nthis, the module also adds the option `-P' to the `local' builtin to declare private  parame‐\nters.\n\nFor  example,  this  construction  fails  if  zsh/param/private  has not yet been loaded when\n`baddeclaration' is defined:\nbaddeclaration() {\nzmodload zsh/param/private\nprivate array=( one two three )\n}\n\nThis construction works because local is already a keyword, and the module is  loaded  before\nthe statement is executed:\ngooddeclaration() {\nzmodload zsh/param/private\nlocal -P array=( one two three )\n}\n\nThe following is usable in scripts but may have trouble with autoload:\nzmodload zsh/param/private\niffydeclaration() {\nprivate array=( one two three )\n}\n\nThe  private  builtin may always be used with scalar assignments and for declarations without\nassignments.\n\nParameters declared with private have the following properties:\n\n•      Within the function body where it is declared, the parameter behaves as a  local,  ex‐\ncept as noted above for tied or special parameters.\n\n•      The  type  of a parameter declared private cannot be changed in the scope where it was\ndeclared, even if the parameter is unset.  Thus an array cannot be assigned to a  pri‐\nvate scalar, etc.\n\n•      Within any other function called by the declaring function, the private parameter does\nNOT hide other parameters of the same name, so for example a global parameter  of  the\nsame  name  is visible and may be assigned or unset.  This includes calls to anonymous\nfunctions, although that may also change in the future.\n\n•      An exported private remains in the environment of inner scopes but appears  unset  for\nthe  current shell in those scopes.  Generally, exporting private parameters should be\navoided.\n\nNote that this differs from the static scope defined by compiled languages derived from C, in\nthat  the  a  new call to the same function creates a new scope, i.e., the parameter is still\nassociated with the call stack rather than with the function definition.  It differs from ksh\n`typeset -S' because the syntax used to define the function has no bearing on whether the pa‐\nrameter scope is respected.\n",
            "subsections": []
        },
        "THE ZSH/REGEX MODULE": {
            "content": "The zsh/regex module makes available the following test condition:\n\nexpr -regex-match regex\nMatches a string against a POSIX extended regular expression.   On  successful  match,\nmatched portion of the string will normally be placed in the MATCH variable.  If there\nare any capturing parentheses within the regex, then the  match  array  variable  will\ncontain  those.   If  the  match is not successful, then the variables will not be al‐\ntered.\n\nFor example,\n\n[[ alphabetical -regex-match ^a([^a]+)a([^a]+)a ]] &&\nprint -l $MATCH X $match\n\nIf the option REMATCHPCRE is not set, then the =~ operator  will  automatically  load\nthis module as needed and will invoke the -regex-match operator.\n\nIf  BASHREMATCH  is set, then the array BASHREMATCH will be set instead of MATCH and\nmatch.\n",
            "subsections": []
        },
        "THE ZSH/SCHED MODULE": {
            "content": "The zsh/sched module makes available one builtin command and one parameter.\n\nsched [-o] [+]hh:mm[:ss] command ...\nsched [-o] [+]seconds command ...\nsched [ -item ]\nMake an entry in the scheduled list of commands to execute.  The time may be specified\nin  either  absolute  or  relative time, and either as hours, minutes and (optionally)\nseconds separated by a colon, or seconds alone.  An absolute number of  seconds  indi‐\ncates  the time since the epoch (1970/01/01 00:00); this is useful in combination with\nthe features in the zsh/datetime module, see the zsh/datetime module entry in  zshmod‐\nules(1).\n\nWith  no  arguments,  prints the list of scheduled commands.  If the scheduled command\nhas the -o flag set, this is shown at the start of the command.\n\nWith the argument `-item', removes the given item from the list.  The numbering of the\nlist is continuous and entries are in time order, so the numbering can change when en‐\ntries are added or deleted.\n\nCommands are executed either immediately before a prompt, or while  the  shell's  line\neditor  is  waiting  for input.  In the latter case it is useful to be able to produce\noutput that does not interfere with the line being edited.  Providing  the  option  -o\ncauses  the shell to clear the command line before the event and redraw it afterwards.\nThis should be used with any scheduled event that produces visible output to the  ter‐\nminal;  it  is not needed, for example, with output that updates a terminal emulator's\ntitle bar.\n\nTo effect changes to the editor buffer when an event executes, use the  `zle'  command\nwith  no  arguments  to test whether the editor is active, and if it is, then use `zle\nwidget' to access the editor via the named widget.\n\nThe sched builtin is not made available by default when the shell starts in a mode em‐\nulating  another  shell.   It  can  be  made  available  with the command `zmodload -F\nzsh/sched b:sched'.\n\nzshscheduledevents\nA readonly array corresponding to the events scheduled by the sched builtin.  The  in‐\ndices of the array correspond to the numbers shown when sched is run with no arguments\n(provided that the KSHARRAYS option is not set).  The value of the array consists  of\nthe  scheduled time in seconds since the epoch (see the section `The zsh/datetime Mod‐\nule' for facilities for using this number), followed by a colon, followed by  any  op‐\ntions  (which  may  be  empty  but will be preceded by a `-' otherwise), followed by a\ncolon, followed by the command to be executed.\n\nThe sched builtin should be used for manipulating the events.   Note  that  this  will\nhave  an immediate effect on the contents of the array, so that indices may become in‐\nvalid.\n",
            "subsections": []
        },
        "THE ZSH/NET/SOCKET MODULE": {
            "content": "The zsh/net/socket module makes available one builtin command:\n\nzsocket [ -altv ] [ -d fd ] [ args ]\nzsocket is implemented as a builtin to allow full use of shell command  line  editing,\nfile I/O, and job control mechanisms.\n",
            "subsections": [
                {
                    "name": "Outbound Connections",
                    "content": "zsocket [ -v ] [ -d fd ] filename\nOpen  a new Unix domain connection to filename.  The shell parameter REPLY will be set\nto the file descriptor associated with that connection.  Currently, only  stream  con‐\nnections are supported.\n\nIf  -d  is specified, its argument will be taken as the target file descriptor for the\nconnection.\n\nIn order to elicit more verbose output, use -v.\n\nFile descriptors can be closed with normal shell syntax when no longer needed, for ex‐\nample:\n\nexec {REPLY}>&-\n"
                },
                {
                    "name": "Inbound Connections",
                    "content": "zsocket -l [ -v ] [ -d fd ] filename\nzsocket  -l  will open a socket listening on filename.  The shell parameter REPLY will\nbe set to the file descriptor associated with that listener.  The file descriptor  re‐\nmains open in subshells and forked external executables.\n\nIf  -d  is specified, its argument will be taken as the target file descriptor for the\nconnection.\n\nIn order to elicit more verbose output, use -v.\n\nzsocket -a [ -tv ] [ -d targetfd ] listenfd\nzsocket -a will accept an incoming connection to the socket associated with  listenfd.\nThe  shell  parameter REPLY will be set to the file descriptor associated with the in‐\nbound connection.  The file descriptor remains open in subshells and  forked  external\nexecutables.\n\nIf  -d  is specified, its argument will be taken as the target file descriptor for the\nconnection.\n\nIf -t is specified, zsocket will return if no incoming connection is pending.   Other‐\nwise it will wait for one.\n\nIn order to elicit more verbose output, use -v.\n"
                }
            ]
        },
        "THE ZSH/STAT MODULE": {
            "content": "The zsh/stat module makes available one builtin command under two possible names:\n\nzstat [ -gnNolLtTrs ] [ -f fd ] [ -H hash ] [ -A array ] [ -F fmt ]\n[ +element ] [ file ... ]\nstat ...\nThe  command acts as a front end to the stat system call (see stat(2)).  The same com‐\nmand is provided with two names; as the name stat is often used by an external command\nit  is  recommended  that only the zstat form of the command is used.  This can be ar‐\nranged by loading the module with the command `zmodload -F zsh/stat b:zstat'.\n\nIf the stat call fails, the appropriate system error message printed and status  1  is\nreturned.   The fields of struct stat give information about the files provided as ar‐\nguments to the command.  In addition to those available from the stat call,  an  extra\nelement `link' is provided.  These elements are:\n\ndevice The number of the device on which the file resides.\n\ninode  The unique number of the file on this device (`inode' number).\n\nmode   The  mode  of  the file; that is, the file's type and access permissions.  With\nthe -s option, this will be returned as a string  corresponding  to  the  first\ncolumn in the display of the ls -l command.\n\nnlink  The number of hard links to the file.\n\nuid    The user ID of the owner of the file.  With the -s option, this is displayed as\na user name.\n\ngid    The group ID of the file.  With the -s option, this is  displayed  as  a  group\nname.\n\nrdev   The raw device number.  This is only useful for special devices.\n\nsize   The size of the file in bytes.\n\natime\nmtime\nctime  The last access, modification and inode change times of the file, respectively,\nas the number of seconds since midnight GMT on 1st January, 1970.  With the  -s\noption, these are printed as strings for the local time zone; the format can be\naltered with the -F option, and with the -g option the times are in GMT.\n\nblksize\nThe number of bytes in one allocation block on the device on which the file re‐\nsides.\n\nblock  The number of disk blocks used by the file.\n\nlink   If the file is a link and the -L option is in effect, this contains the name of\nthe file linked to, otherwise it is empty.  Note that if this  element  is  se‐\nlected (``zstat +link'') then the -L option is automatically used.\n\nA  particular  element  may be selected by including its name preceded by a `+' in the\noption list; only one element is allowed.  The element may be shortened to any  unique\nset of leading characters.  Otherwise, all elements will be shown for all files.\n\nOptions:\n\n-A array\nInstead  of displaying the results on standard output, assign them to an array,\none struct stat element per array element for each file in order.  In this case\nneither  the name of the element nor the name of the files appears in array un‐\nless the -t or -n options were given, respectively.  If -t is given,  the  ele‐\nment name appears as a prefix to the appropriate array element; if -n is given,\nthe file name appears as a separate array element  preceding  all  the  others.\nOther formatting options are respected.\n\n-H hash\nSimilar  to  -A,  but instead assign the values to hash.  The keys are the ele‐\nments listed above.  If the -n option is provided then the name of the file  is\nincluded in the hash with key name.\n\n-f fd  Use  the  file  on  file  descriptor fd instead of named files; no list of file\nnames is allowed in this case.\n\n-F fmt Supplies a strftime (see strftime(3)) string for the formatting of the time el‐\nements.   The format string supports all of the zsh extensions described in the\nsection EXPANSION OF PROMPT SEQUENCES in zshmisc(1).  The -s option is implied.\n\n-g     Show the time elements in the GMT time zone.  The -s option is implied.\n\n-l     List the names of the type elements (to standard output or an array  as  appro‐\npriate)  and  return immediately; arguments, and options other than -A, are ig‐\nnored.\n\n-L     Perform an lstat (see lstat(2)) rather than a stat system call.  In this  case,\nif the file is a link, information about the link itself rather than the target\nfile is returned.  This option is required to make  the  link  element  useful.\nIt's important to note that this is the exact opposite from ls(1), etc.\n\n-n     Always show the names of files.  Usually these are only shown when output is to\nstandard output and there is more than one file in the list.\n\n-N     Never show the names of files.\n\n-o     If a raw file mode is printed, show it in octal, which is more useful for human\nconsumption  than  the  default  of decimal.  A leading zero will be printed in\nthis case.  Note that this does not affect whether a raw or formatted file mode\nis  shown,  which is controlled by the -r and -s options, nor whether a mode is\nshown at all.\n\n-r     Print raw data (the default format) alongside string data (the -s format);  the\nstring data appears in parentheses after the raw data.\n\n-s     Print mode, uid, gid and the three time elements as strings instead of numbers.\nIn each case the format is like that of ls -l.\n\n-t     Always show the type names for the elements of struct stat.  Usually these  are\nonly shown when output is to standard output and no individual element has been\nselected.\n\n-T     Never show the type names of the struct stat elements.\n",
            "subsections": []
        },
        "THE ZSH/SYSTEM MODULE": {
            "content": "The zsh/system module makes available various builtin commands and parameters.\n",
            "subsections": [
                {
                    "name": "Builtins",
                    "content": "syserror [ -e errvar ] [ -p prefix ] [ errno | errname ]\nThis command prints out the error message associated with errno, a system  error  num‐\nber, followed by a newline to standard error.\n\nInstead of the error number, a name errname, for example ENOENT, may be used.  The set\nof names is the same as the contents of the array errnos, see below.\n\nIf the string prefix is given, it is printed in front of the error  message,  with  no\nintervening space.\n\nIf  errvar  is supplied, the entire message, without a newline, is assigned to the pa‐\nrameter names errvar and nothing is output.\n\nA return status of 0 indicates the message was successfully printed (although  it  may\nnot be useful if the error number was out of the system's range), a return status of 1\nindicates an error in the parameters, and a return status of  2  indicates  the  error\nname was not recognised (no message is printed for this).\n\n\nsysopen [ -arw ] [ -m permissions ] [ -o options ]\n-u fd file\nThis command opens a file. The -r, -w and -a flags indicate whether the file should be\nopened for reading, writing and appending, respectively. The -m option allows the ini‐\ntial  permissions to use when creating a file to be specified in octal form.  The file\ndescriptor is specified with -u. Either an explicit file descriptor in the range 0  to\n9 can be specified or a variable name can be given to which the file descriptor number\nwill be assigned.\n\nThe -o option allows various system specific options to be specified as a  comma-sepa‐\nrated  list.  The following is a list of possible options. Note that, depending on the\nsystem, some may not be available.\ncloexec\nmark file to be closed when other programs are executed (else the file descrip‐\ntor remains open in subshells and forked external executables)\n\ncreate\ncreat  create file if it does not exist\n\nexcl   create file, error if it already exists\n\nnoatime\nsuppress updating of the file atime\n\nnofollow\nfail if file is a symbolic link\n\nsync   request that writes wait until data has been physically written\n\ntruncate\ntrunc  truncate file to size 0\n\nTo close the file, use one of the following:\n\nexec {fd}<&-\nexec {fd}>&-\n\n\nsysread [ -c countvar ] [ -i infd ] [ -o outfd ]\n[ -s bufsize ] [ -t timeout ] [ param ]\nPerform  a single system read from file descriptor infd, or zero if that is not given.\nThe result of the read is stored in param or REPLY if that is not given.  If  countvar\nis given, the number of bytes read is assigned to the parameter named by countvar.\n\nThe  maximum number of bytes read is bufsize or 8192 if that is not given, however the\ncommand returns as soon as any number of bytes was successfully read.\n\nIf timeout is given, it specifies a timeout in seconds, which may be zero to poll  the\nfile  descriptor.  This is handled by the poll system call if available, otherwise the\nselect system call if available.\n\nIf outfd is given, an attempt is made to write all the bytes just read to the file de‐\nscriptor  outfd.  If this fails, because of a system error other than EINTR or because\nof an internal zsh error during an interrupt, the  bytes  read  but  not  written  are\nstored  in the parameter named by param if supplied (no default is used in this case),\nand the number of bytes read but not written is  stored  in  the  parameter  named  by\ncountvar if that is supplied.  If it was successful, countvar contains the full number\nof bytes transferred, as usual, and param is not set.\n\nThe error EINTR (interrupted system call) is handled internally so that  shell  inter‐\nrupts are transparent to the caller.  Any other error causes a return.\n\nThe possible return statuses are\n0      At least one byte of data was successfully read and, if appropriate, written.\n\n1      There  was  an  error in the parameters to the command.  This is the only error\nfor which a message is printed to standard error.\n\n2      There was an error on the read, or on polling the input file descriptor  for  a\ntimeout.  The parameter ERRNO gives the error.\n\n3      Data were successfully read, but there was an error writing them to outfd.  The\nparameter ERRNO gives the error.\n\n4      The attempt to read timed out.  Note this does not set ERRNO as this is  not  a\nsystem error.\n\n5      No system error occurred, but zero bytes were read.  This usually indicates end\nof file.  The parameters are set according to the  usual  rules;  no  write  to\noutfd is attempted.\n\nsysseek [ -u fd ] [ -w start|end|current ] offset\nThe current file position at which future reads and writes will take place is adjusted\nto the specified byte offset. The offset is evaluated as a math expression. The -u op‐\ntion  allows  the  file descriptor to be specified. By default the offset is specified\nrelative to the start or the file but, with the -w option, it is possible  to  specify\nthat the offset should be relative to the current position or the end of the file.\n\nsyswrite [ -c countvar ] [ -o outfd ] data\nThe  data (a single string of bytes) are written to the file descriptor outfd, or 1 if\nthat is not given, using the write system call.  Multiple write operations may be used\nif the first does not write all the data.\n\nIf  countvar  is given, the number of byte written is stored in the parameter named by\ncountvar; this may not be the full length of data if an error occurred.\n\nThe error EINTR (interrupted system call) is handled internally by retrying; otherwise\nan  error causes the command to return.  For example, if the file descriptor is set to\nnon-blocking output, an error EAGAIN (on some systems, EWOULDBLOCK) may result in  the\ncommand returning early.\n\nThe  return  status may be 0 for success, 1 for an error in the parameters to the com‐\nmand, or 2 for an error on the write; no error message is printed in  the  last  case,\nbut the parameter ERRNO will reflect the error that occurred.\n\nzsystem flock [ -t timeout ] [ -f var ] [-er] file\nzsystem flock -u fdexpr\nThe  builtin  zsystem's  subcommand  flock performs advisory file locking (via the fc‐\nntl(2) system call) over the entire contents of the given file.  This form of  locking\nrequires  the  processes  accessing the file to cooperate; its most obvious use is be‐\ntween two instances of the shell itself.\n\nIn the first form the named file, which must already exist, is  locked  by  opening  a\nfile descriptor to the file and applying a lock to the file descriptor.  The lock ter‐\nminates when the shell process that created the lock exits; it is therefore often con‐\nvenient  to  create  file  locks within subshells, since the lock is automatically re‐\nleased when the subshell exits.  Note that use of the print builtin with the -u option\nwill, as a side effect, release the lock, as will redirection to the file in the shell\nholding the lock.  To work around this use a subshell, e.g. `(print message) >> file'.\nStatus 0 is returned if the lock succeeds, else status 1.\n\nIn  the  second form the file descriptor given by the arithmetic expression fdexpr is\nclosed, releasing a lock.  The file descriptor can be queried by using  the  `-f  var'\nform  during the lock; on a successful lock, the shell variable var is set to the file\ndescriptor used for locking.  The lock will be released  if  the  file  descriptor  is\nclosed  by  any  other means, for example using `exec {var}>&-'; however, the form de‐\nscribed here performs a safety check that the file descriptor is in use for file lock‐\ning.\n\nBy  default the shell waits indefinitely for the lock to succeed.  The option -t time‐\nout specifies a timeout for the lock in seconds; currently this must  be  an  integer.\nThe  shell will attempt to lock the file once a second during this period.  If the at‐\ntempt times out, status 2 is returned.\n\nIf the option -e is given, the file descriptor for the  lock  is  preserved  when  the\nshell  uses  exec to start a new process; otherwise it is closed at that point and the\nlock released.\n\nIf the option -r is given, the lock is only for reading, otherwise it is  for  reading\nand writing.  The file descriptor is opened accordingly.\n\nzsystem supports subcommand\nThe  builtin  zsystem's  subcommand  supports tests whether a given subcommand is sup‐\nported.  It returns status 0 if so, else status 1.  It operates silently unless  there\nwas  a  syntax error (i.e. the wrong number of arguments), in which case status 255 is\nreturned.  Status 1 can indicate one of two things:  subcommand is known but not  sup‐\nported  by  the current operating system, or subcommand is not known (possibly because\nthis is an older version of the shell before it was implemented).\n"
                },
                {
                    "name": "Math Functions",
                    "content": "systell(fd)\nThe systell math function returns the current file position for  the  file  descriptor\npassed as an argument.\n"
                },
                {
                    "name": "Parameters",
                    "content": "errnos A  readonly  array  of the names of errors defined on the system.  These are typically\nmacros defined in C by including the system header file errno.h.  The  index  of  each\nname (assuming the option KSHARRAYS is unset) corresponds to the error number.  Error\nnumbers num before the last known error which have no name are given the name Enum  in\nthe array.\n\nNote that aliases for errors are not handled; only the canonical name is used.\n"
                },
                {
                    "name": "sysparams",
                    "content": "A readonly associative array.  The keys are:\n\npid    Returns  the process ID of the current process, even in subshells.  Compare $$,\nwhich returns the process ID of the main shell process.\n\nppid   Returns the process ID of the parent of the current process, even in subshells.\nCompare  $PPID,  which  returns  the process ID of the parent of the main shell\nprocess.\n\nprocsubstpid\nReturns the process ID of the last process started  for  process  substitution,\ni.e. the <(...) and >(...) expansions.\n"
                }
            ]
        },
        "THE ZSH/NET/TCP MODULE": {
            "content": "The zsh/net/tcp module makes available one builtin command:\n\nztcp [ -acflLtv ] [ -d fd ] [ args ]\nztcp is implemented as a builtin to allow full use of shell command line editing, file\nI/O, and job control mechanisms.\n\nIf ztcp is run with no options, it will output the contents of its session table.\n\nIf it is run with only the option -L, it will output the contents of the session table\nin  a  format  suitable  for automatic parsing.  The option is ignored if given with a\ncommand to open or close a session.  The output consists of a set of  lines,  one  per\nsession, each containing the following elements separated by spaces:\n\nFile descriptor\nThe file descriptor in use for the connection.  For normal inbound (I) and out‐\nbound (O) connections this may be read and written by the  usual  shell  mecha‐\nnisms.  However, it should only be close with `ztcp -c'.\n\nConnection type\nA letter indicating how the session was created:\n\nZ      A session created with the zftp command.\n\nL      A connection opened for listening with `ztcp -l'.\n\nI      An inbound connection accepted with `ztcp -a'.\n\nO      An outbound connection created with `ztcp host ...'.\n\nThe local host\nThis  is  usually set to an all-zero IP address as the address of the localhost\nis irrelevant.\n\nThe local port\nThis is likely to be zero unless the connection is for listening.\n\nThe remote host\nThis is the fully qualified domain name of the peer, if available, else  an  IP\naddress.  It is an all-zero IP address for a session opened for listening.\n\nThe remote port\nThis is zero for a connection opened for listening.\n",
            "subsections": [
                {
                    "name": "Outbound Connections",
                    "content": "ztcp [ -v ] [ -d fd ] host [ port ]\nOpen  a  new  TCP connection to host.  If the port is omitted, it will default to port\n23.  The connection will be added to the session table and the shell  parameter  REPLY\nwill be set to the file descriptor associated with that connection.\n\nIf  -d  is specified, its argument will be taken as the target file descriptor for the\nconnection.\n\nIn order to elicit more verbose output, use -v.\n"
                },
                {
                    "name": "Inbound Connections",
                    "content": "ztcp -l [ -v ] [ -d fd ] port\nztcp -l will open a socket listening on TCP port.  The socket will  be  added  to  the\nsession table and the shell parameter REPLY will be set to the file descriptor associ‐\nated with that listener.\n\nIf -d is specified, its argument will be taken as the target file descriptor  for  the\nconnection.\n\nIn order to elicit more verbose output, use -v.\n\nztcp -a [ -tv ] [ -d targetfd ] listenfd\nztcp  -a will accept an incoming connection to the port associated with listenfd.  The\nconnection will be added to the session table and the shell parameter  REPLY  will  be\nset to the file descriptor associated with the inbound connection.\n\nIf  -d  is specified, its argument will be taken as the target file descriptor for the\nconnection.\n\nIf -t is specified, ztcp will return if no incoming connection is pending.   Otherwise\nit will wait for one.\n\nIn order to elicit more verbose output, use -v.\n"
                },
                {
                    "name": "Closing Connections",
                    "content": "ztcp -cf [ -v ] [ fd ]\nztcp -c [ -v ] [ fd ]\nztcp -c will close the socket associated with fd.  The socket will be removed from the\nsession table.  If fd is not specified, ztcp will close everything in the session  ta‐\nble.\n\nNormally,  sockets  registered by zftp (see zshmodules(1) ) cannot be closed this way.\nIn order to force such a socket closed, use -f.\n\nIn order to elicit more verbose output, use -v.\n"
                },
                {
                    "name": "Example",
                    "content": "Here is how to create a TCP connection between two instances of zsh.   We  need  to  pick  an\nunassigned port; here we use the randomly chosen 5123.\n\nOn host1,\nzmodload zsh/net/tcp\nztcp -l 5123\nlistenfd=$REPLY\nztcp -a $listenfd\nfd=$REPLY\nThe second from last command blocks until there is an incoming connection.\n\nNow create a connection from host2 (which may, of course, be the same machine):\nzmodload zsh/net/tcp\nztcp host1 5123\nfd=$REPLY\n\nNow  on  each host, $fd contains a file descriptor for talking to the other.  For example, on\nhost1:\nprint This is a message >&$fd\nand on host2:\nread -r line <&$fd; print -r - $line\nprints `This is a message'.\n\nTo tidy up, on host1:\nztcp -c $listenfd\nztcp -c $fd\nand on host2\nztcp -c $fd\n"
                }
            ]
        },
        "THE ZSH/TERMCAP MODULE": {
            "content": "The zsh/termcap module makes available one builtin command:\n\nechotc cap [ arg ... ]\nOutput the termcap value corresponding to the capability cap, with optional arguments.\n\nThe zsh/termcap module makes available one parameter:\n",
            "subsections": [
                {
                    "name": "termcap",
                    "content": "An associative array that maps termcap capability codes to their values.\n"
                }
            ]
        },
        "THE ZSH/TERMINFO MODULE": {
            "content": "The zsh/terminfo module makes available one builtin command:\n\nechoti cap [ arg ]\nOutput the terminfo value corresponding to the capability cap, instantiated  with  arg\nif applicable.\n\nThe zsh/terminfo module makes available one parameter:\n",
            "subsections": [
                {
                    "name": "terminfo",
                    "content": "An associative array that maps terminfo capability names to their values.\n"
                }
            ]
        },
        "THE ZSH/ZFTP MODULE": {
            "content": "The zsh/zftp module makes available one builtin command:\n\nzftp subcommand [ args ]\nThe  zsh/zftp  module is a client for FTP (file transfer protocol).  It is implemented\nas a builtin to allow full use of shell command line editing, file I/O, and  job  con‐\ntrol  mechanisms.   Often,  users  will access it via shell functions providing a more\npowerful interface; a set is provided with the zsh distribution and  is  described  in\nzshzftpsys(1).  However, the zftp command is entirely usable in its own right.\n\nAll  commands  consist  of the command name zftp followed by the name of a subcommand.\nThese are listed below.  The return status of each subcommand is supposed  to  reflect\nthe  success  or  failure  of the remote operation.  See a description of the variable\nZFTPVERBOSE for more information on how responses from the server may be printed.\n",
            "subsections": [
                {
                    "name": "Subcommands",
                    "content": "open host[:port] [ user [ password [ account ] ] ]\nOpen a new FTP session to host, which may be the name of a TCP/IP connected host or an\nIP  number  in  the  standard dot notation.  If the argument is in the form host:port,\nopen a connection to TCP port port instead of the standard FTP port 21.  This  may  be\nthe  name  of  a  TCP service or a number:  see the description of ZFTPPORT below for\nmore information.\n\nIf IPv6 addresses in colon format are used, the host should be  surrounded  by  quoted\nsquare    brackets    to    distinguish    it    from    the    port,    for   example\n'[fe80::203:baff:fe02:8b56]'.  For consistency this is allowed with all forms of host.\n\nRemaining arguments are passed to the login subcommand.  Note that if no arguments be‐\nyond  host  are  supplied, open will not automatically call login.  If no arguments at\nall are supplied, open will use the parameters set by the params subcommand.\n\nAfter a successful  open,  the  shell  variables  ZFTPHOST,  ZFTPPORT,  ZFTPIP  and\nZFTPSYSTEM are available; see `Variables' below.\n\nlogin [ name [ password [ account ] ] ]\nuser [ name [ password [ account ] ] ]\nLogin  the  user name with parameters password and account.  Any of the parameters can\nbe omitted, and will be read from standard input if needed (name  is  always  needed).\nIf standard input is a terminal, a prompt for each one will be printed on standard er‐\nror and password will not be echoed.  If any of the parameters are not used, a warning\nmessage is printed.\n\nAfter a successful login, the shell variables ZFTPUSER, ZFTPACCOUNT and ZFTPPWD are\navailable; see `Variables' below.\n\nThis command may be re-issued when a user is already logged in, and  the  server  will\nfirst be reinitialized for a new user.\n\nparams [ host [ user [ password [ account ] ] ] ]"
                },
                {
                    "name": "params -",
                    "content": "Store  the  given  parameters  for a later open command with no arguments.  Only those\ngiven on the command line will be remembered.  If no arguments are given, the  parame‐\nters  currently set are printed, although the password will appear as a line of stars;\nthe return status is one if no parameters were set, zero otherwise.\n\nAny of the parameters may be specified as a `?', which may need to be quoted  to  pro‐\ntect  it  from  shell expansion.  In this case, the appropriate parameter will be read\nfrom stdin as with the login subcommand, including special handling of  password.   If\nthe  `?' is followed by a string, that is used as the prompt for reading the parameter\ninstead of the default message (any necessary punctuation and whitespace should be in‐\ncluded  at  the  end  of the prompt).  The first letter of the parameter (only) may be\nquoted with a `\\'; hence an argument \"\\\\$word\" guarantees that  the  string  from  the\nshell parameter $word will be treated literally, whether or not it begins with a `?'.\n\nIf  instead  a  single `-' is given, the existing parameters, if any, are deleted.  In\nthat case, calling open with no arguments will cause an error.\n\nThe list of parameters is not deleted after a close, however it will be deleted if the\nzsh/zftp module is unloaded.\n\nFor example,\n\nzftp params ftp.elsewhere.xx juser '?Password for juser: '\n\nwill  store  the host ftp.elsewhere.xx and the user juser and then prompt the user for\nthe corresponding password with the given prompt.\n\ntest   Test the connection; if the server has reported that  it  has  closed  the  connection\n(maybe  due  to  a timeout), return status 2; if no connection was open anyway, return\nstatus 1; else return status 0.  The test subcommand is silent,  apart  from  messages\nprinted  by  the  $ZFTPVERBOSE mechanism, or error messages if the connection closes.\nThere is no network overhead for this test.\n\nThe test is only supported on systems with either  the  select(2)  or  poll(2)  system\ncalls; otherwise the message `not supported on this system' is printed instead.\n\nThe  test subcommand will automatically be called at the start of any other subcommand\nfor the current session when a connection is open.\n\ncd directory\nChange the remote directory to directory.  Also alters the shell variable ZFTPPWD.\n\ncdup   Change the remote directory to the one higher in the directory tree.  Note that cd  ..\nwill also work correctly on non-UNIX systems.\n\ndir [ arg ... ]\nGive a (verbose) listing of the remote directory.  The args are passed directly to the\nserver. The command's behaviour is implementation dependent, but a  UNIX  server  will\ntypically  interpret  args as arguments to the ls command and with no arguments return\nthe result of `ls -l'. The directory is listed to standard output.\n\nls [ arg ... ]\nGive a (short) listing of the remote directory.  With no arg, produces a raw  list  of\nthe files in the directory, one per line.  Otherwise, up to vagaries of the server im‐\nplementation, behaves similar to dir.\n\ntype [ type ]\nChange the type for the transfer to type, or print the current type if type is absent.\nThe  allowed  values  are `A' (ASCII), `I' (Image, i.e. binary), or `B' (a synonym for\n`I').\n\nThe FTP default for a transfer is ASCII.  However, if zftp finds that the remote  host\nis  a  UNIX  machine with 8-bit byes, it will automatically switch to using binary for\nfile transfers upon open.  This can subsequently be overridden.\n\nThe transfer type is only passed to the remote host when a data connection  is  estab‐\nlished; this command involves no network overhead.\n\nascii  The same as type A.\n\nbinary The same as type I.\n\nmode [ S | B ]\nSet  the mode type to stream (S) or block (B).  Stream mode is the default; block mode\nis not widely supported.\n\nremote file ...\nlocal [ file ... ]\nPrint the size and last modification time of the remote or local files.  If  there  is\nmore than one item on the list, the name of the file is printed first.  The first num‐\nber is the file size, the second is the last modification time of the file in the for‐\nmat  CCYYMMDDhhmmSS consisting of year, month, date, hour, minutes and seconds in GMT.\nNote that this format, including the length, is guaranteed, so that time  strings  can\nbe directly compared via the [[ builtin's < and > operators, even if they are too long\nto be represented as integers.\n\nNot all servers support the commands for retrieving this information.  In  that  case,\nthe  remote command will print nothing and return status 2, compared with status 1 for\na file not found.\n\nThe local command (but not remote) may be used with no arguments, in  which  case  the\ninformation  comes from examining file descriptor zero.  This is the same file as seen\nby a put command with no further redirection.\n\nget file ...\nRetrieve all files from the server, concatenating them and sending  them  to  standard\noutput.\n\nput file ...\nFor  each  file, read a file from standard input and send that to the remote host with\nthe given name.\n\nappend file ...\nAs put, but if the remote file already exists, data is appended to it instead of over‐\nwriting it.\n\ngetat file point\nputat file point\nappendat file point\nVersions  of  get,  put and append which will start the transfer at the given point in\nthe remote file.  This is useful for appending to an incomplete local file.   However,\nnote  that  this ability is not universally supported by servers (and is not quite the\nbehaviour specified by the standard).\n\ndelete file ...\nDelete the list of files on the server.\n\nmkdir directory\nCreate a new directory directory on the server.\n\nrmdir directory\nDelete the directory directory  on the server.\n\nrename old-name new-name\nRename file old-name to new-name on the server.\n\nsite arg ...\nSend a host-specific command to the server.  You will probably only need this  if  in‐\nstructed by the server to use it.\n\nquote arg ...\nSend  the raw FTP command sequence to the server.  You should be familiar with the FTP\ncommand set as defined in RFC959 before doing this.  Useful commands may include  STAT\nand  HELP.   Note also the mechanism for returning messages as described for the vari‐\nable ZFTPVERBOSE below, in particular that all messages from the  control  connection\nare sent to standard error.\n"
                },
                {
                    "name": "close",
                    "content": "quit   Close  the  current  data  connection.   This  unsets  the shell parameters ZFTPHOST,\nZFTPPORT, ZFTPIP, ZFTPSYSTEM,  ZFTPUSER,  ZFTPACCOUNT,  ZFTPPWD,  ZFTPTYPE  and\nZFTPMODE.\n\nsession [ sessname ]\nAllows  multiple FTP sessions to be used at once.  The name of the session is an arbi‐\ntrary string of characters; the default session is called `default'.  If this  command\nis  called  without  an argument, it will list all the current sessions; with an argu‐\nment, it will either switch to the existing session called sessname, or create  a  new\nsession of that name.\n\nEach  session  remembers  the status of the connection, the set of connection-specific\nshell parameters (the same set as are unset when a connection closes, as given in  the\ndescription  of  close), and any user parameters specified with the params subcommand.\nChanging to a previous session restores those values; changing to a new  session  ini‐\ntialises  them  in the same way as if zftp had just been loaded.  The name of the cur‐\nrent session is given by the parameter ZFTPSESSION.\n\nrmsession [ sessname ]\nDelete a session; if a name is not given, the current session is deleted.  If the cur‐\nrent  session  is  deleted, the earliest existing session becomes the new current ses‐\nsion, otherwise the current session is not changed.  If the session being  deleted  is\nthe  only  one, a new session called `default' is created and becomes the current ses‐\nsion; note that this is a new session even if the session being deleted is also called\n`default'.  It  is  recommended that sessions not be deleted while background commands\nwhich use zftp are still active.\n"
                },
                {
                    "name": "Parameters",
                    "content": "The following shell parameters are used by zftp.  Currently none of them are special.\n\nZFTPTMOUT\nInteger.  The time in seconds to wait for a network operation to complete  before  re‐\nturning  an error.  If this is not set when the module is loaded, it will be given the\ndefault value 60.  A value of zero turns off timeouts.  If a  timeout  occurs  on  the\ncontrol  connection  it  will  be  closed.  Use a larger value if this occurs too fre‐\nquently.\n\nZFTPIP\nReadonly.  The IP address of the current connection in dot notation.\n\nZFTPHOST\nReadonly.  The hostname of the current remote server.  If the host was opened as an IP\nnumber, ZFTPHOST contains that instead; this saves the overhead for a name lookup, as\nIP numbers are most commonly used when a nameserver is unavailable.\n\nZFTPPORT\nReadonly.  The number of the remote TCP port to which the connection is open (even  if\nthe  port  was originally specified as a named service).  Usually this is the standard\nFTP port, 21.\n\nIn the unlikely event that your system does not have the appropriate conversion  func‐\ntions,  this appears in network byte order.  If your system is little-endian, the port\nthen consists of two swapped bytes and the standard port will be reported as 5376.  In\nthat case, numeric ports passed to zftp open will also need to be in this format.\n\nZFTPSYSTEM\nReadonly.   The  system  type string returned by the server in response to an FTP SYST\nrequest.  The most interesting case is a string beginning \"UNIX Type: L8\",  which  en‐\nsures maximum compatibility with a local UNIX host.\n\nZFTPTYPE\nReadonly.   The type to be used for data transfers , either `A' or `I'.   Use the type\nsubcommand to change this.\n\nZFTPUSER\nReadonly.  The username currently logged in, if any.\n\nZFTPACCOUNT\nReadonly.  The account name of the current user, if any.  Most servers do not  require\nan account name.\n\nZFTPPWD\nReadonly.  The current directory on the server.\n\nZFTPCODE\nReadonly.   The  three  digit  code of the last FTP reply from the server as a string.\nThis can still be read after the connection is closed, and is  not  changed  when  the\ncurrent session changes.\n\nZFTPREPLY\nReadonly.  The last line of the last reply sent by the server.  This can still be read\nafter the connection is closed, and is not changed when the current session changes.\n\nZFTPSESSION\nReadonly.  The name of the current FTP session; see the  description  of  the  session\nsubcommand.\n\nZFTPPREFS\nA  string of preferences for altering aspects of zftp's behaviour.  Each preference is\na single character.  The following are defined:\n\nP      Passive:  attempt to make the remote server initiate data transfers.   This  is\nslightly  more  efficient  than sendport mode.  If the letter S occurs later in\nthe string, zftp will use sendport mode if passive mode is not available.\n\nS      Sendport:  initiate transfers by the FTP PORT command.  If this  occurs  before\nany P in the string, passive mode will never be attempted.\n\nD      Dumb:   use only the bare minimum of FTP commands.  This prevents the variables\nZFTPSYSTEM and ZFTPPWD from being set, and will mean all connections  default\nto  ASCII  type.   It may prevent ZFTPSIZE from being set during a transfer if\nthe server does not send it anyway (many servers do).\n\nIf ZFTPPREFS is not set when zftp is loaded, it will be set to  a  default  of  `PS',\ni.e. use passive mode if available, otherwise fall back to sendport mode.\n\nZFTPVERBOSE\nA  string  of  digits  between  0 and 5 inclusive, specifying which responses from the\nserver should be printed.  All responses go to standard error.  If any of the  numbers\n1  to 5 appear in the string, raw responses from the server with reply codes beginning\nwith that digit will be printed to standard error.  The first digit of the three digit\nreply code is defined by RFC959 to correspond to:\n\n1.     A positive preliminary reply.\n\n2.     A positive completion reply.\n\n3.     A positive intermediate reply.\n\n4.     A transient negative completion reply.\n\n5.     A permanent negative completion reply.\n\nIt should be noted that, for unknown reasons, the reply `Service not available', which\nforces termination of a connection, is classified as 421, i.e.  `transient  negative',\nan interesting interpretation of the word `transient'.\n\nThe  code  0 is special:  it indicates that all but the last line of multiline replies\nread from the server will be printed to standard error in a processed format.  By con‐\nvention, servers use this mechanism for sending information for the user to read.  The\nappropriate reply code, if it matches the same response, takes priority.\n\nIf ZFTPVERBOSE is not set when zftp is loaded, it will be set to  the  default  value\n450,  i.e.,  messages  destined  for  the user and all errors will be printed.  A null\nstring is valid and specifies that no messages should be printed.\n"
                },
                {
                    "name": "Functions",
                    "content": "zftpchpwd\nIf this function is set by the user, it is called every time the directory changes  on\nthe  server,  including  when a user is logged in, or when a connection is closed.  In\nthe last case, $ZFTPPWD will be unset; otherwise it will reflect the new directory.\n\nzftpprogress\nIf this function is set by the user, it will be called during a get, put or append op‐\neration  each time sufficient data has been received from the host.  During a get, the\ndata is sent to standard output, so it is vital that this  function  should  write  to\nstandard error or directly to the terminal, not to standard output.\n\nWhen  it is called with a transfer in progress, the following additional shell parame‐\nters are set:\n\nZFTPFILE\nThe name of the remote file being transferred from or to.\n\nZFTPTRANSFER\nA G for a get operation and a P for a put operation.\n\nZFTPSIZE\nThe total size of the complete file being transferred: the same  as  the  first\nvalue  provided  by the remote and local subcommands for a particular file.  If\nthe server cannot supply this value for a remote file being retrieved, it  will\nnot  be set.  If input is from a pipe the value may be incorrect and correspond\nsimply to a full pipe buffer.\n\nZFTPCOUNT\nThe amount of data so far transferred; a number between zero and $ZFTPSIZE, if\nthat is set.  This number is always available.\n\nThe  function  is initially called with ZFTPTRANSFER set appropriately and ZFTPCOUNT\nset to zero.  After the transfer is finished, the function will  be  called  one  more\ntime  with  ZFTPTRANSFER set to GF or PF, in case it wishes to tidy up.  It is other‐\nwise never called twice with the same value of ZFTPCOUNT.\n\nSometimes the progress meter may cause disruption.  It is up to  the  user  to  decide\nwhether the function should be defined and to use unfunction when necessary.\n"
                },
                {
                    "name": "Problems",
                    "content": "A  connection  may not be opened in the left hand side of a pipe as this occurs in a subshell\nand the file information is not updated in the main shell.  In  the  case  of  type  or  mode\nchanges  or  closing  the connection in a subshell, the information is returned but variables\nare not updated until the next call to zftp.  Other status changes in subshells will  not  be\nreflected by changes to the variables (but should be otherwise harmless).\n\nDeleting  sessions  while  a zftp command is active in the background can have unexpected ef‐\nfects, even if it does not use the session being deleted.  This is because all shell  subpro‐\ncesses  share information on the state of all connections, and deleting a session changes the\nordering of that information.\n\nOn some operating systems, the control connection is not valid after a fork(), so that opera‐\ntions  in subshells, on the left hand side of a pipeline, or in the background are not possi‐\nble, as they should be.  This is presumably a bug in the operating system.\n"
                }
            ]
        },
        "THE ZSH/ZLE MODULE": {
            "content": "The zsh/zle module contains the Zsh Line Editor.  See zshzle(1).\n",
            "subsections": []
        },
        "THE ZSH/ZLEPARAMETER MODULE": {
            "content": "The zsh/zleparameter module defines two special parameters that can be used to access  inter‐\nnal information of the Zsh Line Editor (see zshzle(1)).\n",
            "subsections": [
                {
                    "name": "keymaps",
                    "content": "This array contains the names of the keymaps currently defined.\n"
                },
                {
                    "name": "widgets",
                    "content": "This  associative  array  contains one entry per widget. The name of the widget is the\nkey and the value gives information about the widget. It is either\nthe string `builtin' for builtin widgets,\na string of the form `user:name' for user-defined widgets,\nwhere name is the name of the shell function implementing the widget,\na string of the form `completion:type:name'\nfor completion widgets,\nor a null value if the widget is not yet fully defined.  In  the  penultimate  case,\ntype  is the name of the builtin widget the completion widget imitates in its behavior\nand name is the name of the shell function implementing the completion widget.\n"
                }
            ]
        },
        "THE ZSH/ZPROF MODULE": {
            "content": "When loaded, the zsh/zprof causes shell functions to be profiled.  The profiling results  can\nbe obtained with the zprof builtin command made available by this module.  There is no way to\nturn profiling off other than unloading the module.\n\nzprof [ -c ]\nWithout the -c option, zprof lists profiling results to standard output.   The  format\nis comparable to that of commands like gprof.\n\nAt  the  top  there is a summary listing all functions that were called at least once.\nThis summary is sorted in decreasing order of the amount of time spent in  each.   The\nlines contain the number of the function in order, which is used in other parts of the\nlist in suffixes of the form `[num]', then the number of calls made to  the  function.\nThe next three columns list the time in milliseconds spent in the function and its de‐\nscendants, the average time in milliseconds spent in the function and its  descendants\nper call and the percentage of time spent in all shell functions used in this function\nand its descendants.  The following three  columns  give  the  same  information,  but\ncounting  only the time spent in the function itself.  The final column shows the name\nof the function.\n\nAfter the summary, detailed information about  every  function  that  was  invoked  is\nlisted,  sorted  in  decreasing order of the amount of time spent in each function and\nits descendants.  Each of these entries consists of  descriptions  for  the  functions\nthat  called  the function described, the function itself, and the functions that were\ncalled from it.  The description for the function itself has the same format as in the\nsummary  (and  shows  the same information).  The other lines don't show the number of\nthe function at the beginning and have their function named indented to make it easier\nto  distinguish  the  line showing the function described in the section from the sur‐\nrounding lines.\n\nThe information shown in this case is almost the same as  in  the  summary,  but  only\nrefers to the call hierarchy being displayed.  For example, for a calling function the\ncolumn showing the total running time lists the time spent in the  described  function\nand its descendants only for the times when it was called from that particular calling\nfunction.  Likewise, for a called function, this columns lists the total time spent in\nthe called function and its descendants only for the times when it was called from the\nfunction described.\n\nAlso in this case, the column showing the number of calls to a function also  shows  a\nslash and then the total number of invocations made to the called function.\n\nAs long as the zsh/zprof module is loaded, profiling will be done and multiple invoca‐\ntions of the zprof builtin command will show the times and numbers of calls since  the\nmodule  was  loaded.  With the -c option, the zprof builtin command will reset its in‐\nternal counters and will not show the listing.\n",
            "subsections": []
        },
        "THE ZSH/ZPTY MODULE": {
            "content": "The zsh/zpty module offers one builtin:\n\nzpty [ -e ] [ -b ] name [ arg ... ]\nThe arguments following name are concatenated with spaces between, then executed as  a\ncommand,  as  if  passed to the eval builtin.  The command runs under a newly assigned\npseudo-terminal; this is useful for running commands non-interactively which expect an\ninteractive environment.  The name is not part of the command, but is used to refer to\nthis command in later calls to zpty.\n\nWith the -e option, the pseudo-terminal is set up so that input characters are echoed.\n\nWith the -b option, input to and output from the pseudo-terminal are  made  non-block‐\ning.\n\nThe shell parameter REPLY is set to the file descriptor assigned to the master side of\nthe pseudo-terminal.  This allows the terminal to be  monitored  with  ZLE  descriptor\nhandlers  (see zshzle(1)) or manipulated with sysread and syswrite (see THE ZSH/SYSTEM\nMODULE in zshmodules(1)).  Warning: Use of sysread and syswrite  is  not  recommended;\nuse zpty -r and zpty -w unless you know exactly what you are doing.\n\nzpty -d [ name ... ]\nThe second form, with the -d option, is used to delete commands previously started, by\nsupplying a list of their names.  If no name  is  given,  all  commands  are  deleted.\nDeleting a command causes the HUP signal to be sent to the corresponding process.\n\nzpty -w [ -n ] name [ string ... ]\nThe -w option can be used to send the to command name the given strings as input (sep‐\narated by spaces).  If the -n option is not given, a newline is added at the end.\n\nIf no string is provided, the standard input is copied to  the  pseudo-terminal;  this\nmay  stop  before  copying the full input if the pseudo-terminal is non-blocking.  The\nexact input is always copied: the -n option is not applied.\n\nNote that the command under the pseudo-terminal sees this input as if it  were  typed,\nso  beware  when  sending special tty driver characters such as word-erase, line-kill,\nand end-of-file.\n\nzpty -r [ -mt ] name [ param [ pattern ] ]\nThe -r option can be used to read the output of the command name.  With  only  a  name\nargument,  the output read is copied to the standard output.  Unless the pseudo-termi‐\nnal is non-blocking, copying continues until the command under the pseudo-terminal ex‐\nits;  when  non-blocking,  only  as much output as is immediately available is copied.\nThe return status is zero if any output is copied.\n\nWhen also given a param argument, at most one line is read and stored in the parameter\nnamed  param.   Less than a full line may be read if the pseudo-terminal is non-block‐\ning.  The return status is zero if at least one character is stored in param.\n\nIf a pattern is given as well, output is read until the whole string read matches  the\npattern,  even in the non-blocking case.  The return status is zero if the string read\nmatches the pattern, or if the command has exited but at  least  one  character  could\nstill  be  read.   If  the option -m is present, the return status is zero only if the\npattern matches.  As of this writing, a maximum of one megabyte of output can be  con‐\nsumed  this  way;  if a full megabyte is read without matching the pattern, the return\nstatus is non-zero.\n\nIn all cases, the return status is non-zero if nothing could be read, and is 2 if this\nis because the command has finished.\n\nIf  the  -r option is combined with the -t option, zpty tests whether output is avail‐\nable before trying to read.  If no output is available, zpty immediately  returns  the\nstatus 1.  When used with a pattern, the behaviour on a failed poll is similar to when\nthe command has exited:  the return value is zero if  at  least  one  character  could\nstill be read even if the pattern failed to match.\n\nzpty -t name\nThe  -t  option  without the -r option can be used to test whether the command name is\nstill running.  It returns a zero status if the command  is  running  and  a  non-zero\nvalue otherwise.\n\nzpty [ -L ]\nThe  last form, without any arguments, is used to list the commands currently defined.\nIf the -L option is given, this is done in the form of calls to the zpty builtin.\n",
            "subsections": []
        },
        "THE ZSH/ZSELECT MODULE": {
            "content": "The zsh/zselect module makes available one builtin command:\n\nzselect [ -rwe ] [ -t timeout ] [ -a array ] [ -A assoc ] [ fd ... ]\nThe zselect builtin is a front-end to the `select' system call, which blocks  until  a\nfile  descriptor  is  ready for reading or writing, or has an error condition, with an\noptional timeout.  If this is not available on your system, the command prints an  er‐\nror  message  and returns status 2 (normal errors return status 1).  For more informa‐\ntion, see your systems documentation for select(3).  Note there is no connection  with\nthe shell builtin of the same name.\n\nArguments and options may be intermingled in any order.  Non-option arguments are file\ndescriptors, which must be decimal integers.  By default, file descriptors are  to  be\ntested  for  reading,  i.e. zselect will return when data is available to be read from\nthe file descriptor, or more precisely, when a read operation from the file descriptor\nwill  not  block.   After a -r, -w and -e, the given file descriptors are to be tested\nfor reading, writing, or error conditions.  These options and  an  arbitrary  list  of\nfile descriptors may be given in any order.\n\n(The  presence  of  an  `error condition' is not well defined in the documentation for\nmany implementations of the select system call.  According to recent versions  of  the\nPOSIX  specification,  it is really an exception condition, of which the only standard\nexample is out-of-band data received on a socket.  So zsh users are unlikely  to  find\nthe -e option useful.)\n\nThe  option  `-t  timeout' specifies a timeout in hundredths of a second.  This may be\nzero, in which case the file descriptors will simply be polled and zselect will return\nimmediately.   It  is possible to call zselect with no file descriptors and a non-zero\ntimeout for use as a finer-grained replacement for `sleep'; note, however, the  return\nstatus is always 1 for a timeout.\n\nThe option `-a array' indicates that array should be set to indicate the file descrip‐\ntor(s) which are ready.  If the option is not given, the array reply will be used  for\nthis  purpose.   The array will contain a string similar to the arguments for zselect.\nFor example,\n\nzselect -t 0 -r 0 -w 1\n\nmight return immediately with status 0 and $reply containing `-r 0 -w 1' to show  that\nboth file descriptors are ready for the requested operations.\n\nThe  option `-A assoc' indicates that the associative array assoc should be set to in‐\ndicate the file descriptor(s) which are ready.  This option overrides the  option  -a,\nnor  will reply be modified.  The keys of assoc are the file descriptors, and the cor‐\nresponding values are any of the characters `rwe' to indicate the condition.\n\nThe command returns status 0 if some file descriptors are ready for reading.   If  the\noperation  timed  out, or a timeout of 0 was given and no file descriptors were ready,\nor there was an error, it returns status 1 and the array will not be set (nor modified\nin any way).  If there was an error in the select operation the appropriate error mes‐\nsage is printed.\n",
            "subsections": []
        },
        "THE ZSH/ZUTIL MODULE": {
            "content": "The zsh/zutil module only adds some builtins:\n\nzstyle [ -L [ metapattern [ style ] ] ]\nzstyle [ -e | - | -- ] pattern style string ...\nzstyle -d [ pattern [ style ... ] ]\nzstyle -g name [ pattern [ style ] ]\nzstyle -{a|b|s} context style name [ sep ]\nzstyle -{T|t} context style [ string ... ]\nzstyle -m context style pattern\nThis builtin command is used to define and lookup styles.  Styles are pairs  of  names\nand  values,  where  the values consist of any number of strings.  They are stored to‐\ngether with patterns and lookup is done by giving  a  string,  called  the  `context',\nwhich  is  matched  against the patterns.  The definition stored for the most specific\npattern that matches will be returned.\n\nA pattern is considered to be more specific than another if it  contains  more  compo‐\nnents  (substrings separated by colons) or if the patterns for the components are more\nspecific, where simple strings are considered to be more specific  than  patterns  and\ncomplex  patterns  are  considered to be more specific than the pattern `*'.  A `*' in\nthe pattern will match zero or more characters in the context; colons are not  treated\nspecially  in this regard.  If two patterns are equally specific, the tie is broken in\nfavour of the pattern that was defined first.\n\nExample\n\nFor example, to define your preferred form of precipitation depending  on  which  city\nyou're in, you might set the following in your zshrc:\n\nzstyle ':weather:europe:*' preferred-precipitation rain\nzstyle ':weather:europe:germany:* preferred-precipitation none\nzstyle ':weather:europe:germany:*:munich' preferred-precipitation snow\n\nThen, the fictional `weather' plugin might run under the hood a command such as\n\nzstyle -s \":weather:${continent}:${country}:${county}:${city}\" preferred-precipitation REPLY\n\nin order to retrieve your preference into the scalar variable $REPLY.\n\nUsage\n\nThe forms that operate on patterns are the following.\n\nzstyle [ -L [ metapattern [ style ] ] ]\nWithout arguments, lists style definitions.  Styles are shown in alphabetic or‐\nder and patterns are shown in the order zstyle will test them.\n\nIf the -L option is given, listing is done in the form of calls to zstyle.  The\noptional  first  argument,  metapattern,  is  a  pattern  which will be matched\nagainst the string supplied as pattern when the style was defined.  Note:  this\nmeans, for example, `zstyle -L \":completion:*\"' will match any supplied pattern\nbeginning `:completion:', not just \":completion:*\":   use  ':completion:\\*'  to\nmatch that.  The optional second argument limits the output to a specific style\n(not a pattern).  -L is not compatible with any other options.\n\nzstyle [ - | -- | -e ] pattern style string ...\nDefines the given style for the pattern with the strings as the value.  If  the\n-e  option is given, the strings will be concatenated (separated by spaces) and\nthe resulting string will be evaluated (in the same way as it is  done  by  the\neval  builtin command) when the style is looked up.  In this case the parameter\n`reply' must be assigned to set the strings returned after the evaluation.  Be‐\nfore  evaluating  the value, reply is unset, and if it is still unset after the\nevaluation, the style is treated as if it were not set.\n\nzstyle -d [ pattern [ style ... ] ]\nDelete style definitions. Without arguments all definitions are deleted, with a\npattern  all  definitions  for  that  pattern are deleted and if any styles are\ngiven, then only those styles are deleted for the pattern.\n\nzstyle -g name [ pattern [ style ] ]\nRetrieve a style definition. The name is used as the name of an array in  which\nthe results are stored. Without any further arguments, all patterns defined are\nreturned. With a pattern the styles defined for that pattern are  returned  and\nwith  both  a pattern and a style, the value strings of that combination is re‐\nturned.\n\nThe other forms can be used to look up or test styles for a given context.\n\nzstyle -s context style name [ sep ]\nThe parameter name is set to the value of the style interpreted  as  a  string.\nIf  the  value  contains  several strings they are concatenated with spaces (or\nwith the sep string if that is given) between them.\n\nReturn 0 if the style is set, 1 otherwise.\n\nzstyle -b context style name\nThe value is stored in name as a boolean, i.e. as the string `yes' if the value\nhas  only one string and that string is equal to one of `yes', `true', `on', or\n`1'. If the value is any other string or has more than one string, the  parame‐\nter is set to `no'.\n\nReturn 0 if name is set to `yes', 1 otherwise.\n\nzstyle -a context style name\nThe  value is stored in name as an array. If name is declared as an associative\narray,  the first, third, etc. strings are used  as  the  keys  and  the  other\nstrings are used as the values.\n\nReturn 0 if the style is set, 1 otherwise.\n\nzstyle -t context style [ string ... ]\nzstyle -T context style [ string ... ]\nTest  the value of a style, i.e. the -t option only returns a status (sets $?).\nWithout any string the return status is zero if the style  is  defined  for  at\nleast one matching pattern, has only one string in its value, and that is equal\nto one of `true', `yes', `on' or `1'. If any strings are given  the  status  is\nzero if and only if at least one of the strings is equal to at least one of the\nstrings in the value. If the style is defined but  doesn't  match,  the  return\nstatus is 1. If the style is not defined, the status is 2.\n\nThe -T option tests the values of the style like -t, but it returns status zero\n(rather than 2) if the style is not defined for any matching pattern.\n\nzstyle -m context style pattern\nMatch a value. Returns status zero if the pattern matches at least one  of  the\nstrings in the value.\n\nzformat -f param format spec ...\nzformat -a array sep spec ...\nThis  builtin  provides  two different forms of formatting. The first form is selected\nwith the -f option. In this case the format string will be modified by  replacing  se‐\nquences  starting  with  a  percent sign in it with strings from the specs.  Each spec\nshould be of the form `char:string' which will cause every appearance of the  sequence\n`%char' in format to be replaced by the string.  The `%' sequence may also contain op‐\ntional minimum and maximum field width specifications between the `%' and  the  `char'\nin  the form `%min.maxc', i.e. the minimum field width is given first and if the maxi‐\nmum field width is used, it has to be preceded by a dot.  Specifying a  minimum  field\nwidth  makes  the  result  be padded with spaces to the right if the string is shorter\nthan the requested width.  Padding to the left can be achieved by  giving  a  negative\nminimum  field width.  If a maximum field width is specified, the string will be trun‐\ncated after that many characters.  After all `%' sequences for the  given  specs  have\nbeen processed, the resulting string is stored in the parameter param.\n\nThe  %-escapes also understand ternary expressions in the form used by prompts.  The %\nis followed by a `(' and then an ordinary  format  specifier  character  as  described\nabove.   There  may be a set of digits either before or after the `('; these specify a\ntest number, which defaults to zero.  Negative numbers are also allowed.  An arbitrary\ndelimiter  character  follows  the  format  specifier, which is followed by a piece of\n`true' text, the delimiter character again, a piece of `false'  text,  and  a  closing\nparenthesis.    The   complete   expression  (without  the  digits)  thus  looks  like\n`%(X.text1.text2)', except that the `.' character is arbitrary.  The value  given  for\nthe format specifier in the char:string expressions is evaluated as a mathematical ex‐\npression, and compared with the test number.  If they are the same, text1  is  output,\nelse  text2  is output.  A parenthesis may be escaped in text2 as %).  Either of text1\nor text2 may contain nested %-escapes.\n\nFor example:\n\nzformat -f REPLY \"The answer is '%3(c.yes.no)'.\" c:3\n\noutputs \"The answer is 'yes'.\" to REPLY since the value for the format specifier c  is\n3, agreeing with the digit argument to the ternary expression.\n\nThe  second  form,  using  the -a option, can be used for aligning strings.  Here, the\nspecs are of the form `left:right' where `left' and  `right'  are  arbitrary  strings.\nThese  strings  are modified by replacing the colons by the sep string and padding the\nleft strings with spaces to the right so that the sep strings in the result (and hence\nthe  right  strings  after them) are all aligned if the strings are printed below each\nother.  All strings without a colon are left unchanged and all strings with  an  empty\nright  string  have  the  trailing  colon  removed.   In both cases the lengths of the\nstrings are not used to determine how the other strings are to be aligned.  A colon in\nthe  left string can be escaped with a backslash.  The resulting strings are stored in\nthe array.\n",
            "subsections": [
                {
                    "name": "zregexparse",
                    "content": "This implements some internals of the regexarguments function.\n\nzparseopts [ -D -E -F -K -M ] [ -a array ] [ -A assoc ] [ - ] spec ...\nThis builtin simplifies the parsing of options in positional parameters, i.e. the  set\nof  arguments  given  by  $*.   Each spec describes one option and must be of the form\n`opt[=array]'.  If an option described by opt is found in the positional parameters it\nis  copied  into  the  array specified with the -a option; if the optional `=array' is\ngiven, it is instead copied into that array, which should be declared as a normal  ar‐\nray and never as an associative array.\n\nNote  that it is an error to give any spec without an `=array' unless one of the -a or\n-A options is used.\n\nUnless the -E option is given, parsing stops at the first string that isn't  described\nby  one  of  the  specs.  Even with -E, parsing always stops at a positional parameter\nequal to `-' or `--'. See also -F.\n\nThe opt description must be one of the following.  Any of the special  characters  can\nappear in the option name provided it is preceded by a backslash.\n\nname\nname+  The  name  is  the  name  of  the option without the leading `-'.  To specify a\nGNU-style long option, one of the usual two leading `-'  must  be  included  in\nname; for example, a `--file' option is represented by a name of `-file'.\n\nIf  a  `+'  appears after name, the option is appended to array each time it is\nfound in the positional parameters; without the `+' only the last occurrence of\nthe option is preserved.\n\nIf  one  of these forms is used, the option takes no argument, so parsing stops\nif the next positional parameter does not also begin with `-'  (unless  the  -E\noption is used).\n\nname:\nname:-\nname:: If  one  or two colons are given, the option takes an argument; with one colon,\nthe argument is mandatory and with two colons it is optional.  The argument  is\nappended to the array after the option itself.\n\nAn  optional  argument  is  put  into the same array element as the option name\n(note that this makes empty strings as arguments indistinguishable).  A  manda‐\ntory  argument  is added as a separate element unless the `:-' form is used, in\nwhich case the argument is put into the same element.\n\nA `+' as described above may appear between the name and the first colon.\n\nIn all cases, option-arguments must appear either immediately following the option  in\nthe same positional parameter or in the next one. Even an optional argument may appear\nin the next parameter, unless it begins with a `-'.  There is no special  handling  of\n`=' as with GNU-style argument parsers; given the spec `-foo:', the positional parame‐\nter `--foo=bar' is parsed as `--foo' with an argument of `=bar'.\n\nWhen the names of two options that take no arguments overlap, the longest one wins, so\nthat  parsing  for the specs `-foo -foobar' (for example) is unambiguous. However, due\nto the aforementioned handling of option-arguments,  ambiguities  may  arise  when  at\nleast one overlapping spec takes an argument, as in `-foo: -foobar'. In that case, the\nlast matching spec wins.\n\nThe options of zparseopts itself cannot be stacked because,  for  example,  the  stack\n`-DEK'  is  indistinguishable  from a spec for the GNU-style long option `--DEK'.  The\noptions of zparseopts itself are:\n\n-a array\nAs described above, this names the default array in which to store  the  recog‐\nnised options.\n\n-A assoc\nIf this is given, the options and their values are also put into an associative\narray with the option names as keys and the arguments (if any) as the values.\n\n-D     If this option is given, all options found are removed from the positional  pa‐\nrameters  of  the  calling shell or shell function, up to but not including any\nnot described by the specs.  If the first such parameter is `-' or `--', it  is\nremoved as well.  This is similar to using the shift builtin.\n\n-E     This  changes  the parsing rules to not stop at the first string that isn't de‐\nscribed by one of the specs.  It can be used to test for or (if  used  together\nwith  -D)  extract  options and their arguments, ignoring all other options and\narguments that may be in the positional parameters.  As indicated above,  pars‐\ning still stops at the first `-' or `--' not described by a spec, but it is not\nremoved when used with -D.\n\n-F     If this option is given, zparseopts immediately stops at the first  option-like\nparameter  not  described by one of the specs, prints an error message, and re‐\nturns status 1.  Removal (-D) and extraction (-E) are not performed, and option\narrays are not updated.  This provides basic validation for the given options.\n\nNote  that the appearance in the positional parameters of an option without its\nrequired argument always aborts parsing and returns an error as described above\nregardless of whether this option is used.\n\n-K     With this option, the arrays specified with the -a option and with the `=array'\nforms are kept unchanged when none of the specs for them  is  used.   Otherwise\nthe  entire  array  is replaced when any of the specs is used.  Individual ele‐\nments of associative arrays specified with the -A option are preserved  by  -K.\nThis allows assignment of default values to arrays before calling zparseopts.\n\n-M     This  changes  the  assignment rules to implement a map among equivalent option\nnames.  If any spec uses the `=array' form, the string array is interpreted  as\nthe  name  of  another spec, which is used to choose where to store the values.\nIf no other spec is found, the values are stored as usual.  This  changes  only\nthe  way the values are stored, not the way $* is parsed, so results may be un‐\npredictable if the `name+' specifier is used inconsistently.\n\nFor example,\n\nset -- -a -bx -c y -cz baz -cend\nzparseopts a=foo b:=bar c+:=bar\n\nwill have the effect of\n\nfoo=(-a)\nbar=(-b x -c y -c z)\n\nThe arguments from `baz' on will not be used.\n\nAs an example for the -E option, consider:\n\nset -- -a x -b y -c z arg1 arg2\nzparseopts -E -D b:=bar\n\nwill have the effect of\n\nbar=(-b y)\nset -- -a x -c z arg1 arg2\n\nI.e., the option -b and its arguments are taken from the positional parameters and put\ninto the array bar.\n\nThe -M option can be used like this:\n\nset -- -a -bx -c y -cz baz -cend\nzparseopts -A bar -M a=foo b+: c:=b\n\nto have the effect of\n\nfoo=(-a)\nbar=(-a '' -b xyz)\n\n\n\nzsh 5.8.1                                 February 12, 2022                            ZSHMODULES(1)"
                }
            ]
        }
    },
    "summary": "zshmodules - zsh loadable modules",
    "flags": [],
    "examples": [],
    "see_also": []
}