{
    "mode": "man",
    "parameter": "zshmisc",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/zshmisc/1/json",
    "generated": "2026-11-09T19:24:11Z",
    "sections": {
        "NAME": {
            "content": "zshmisc - everything and then some\n\nSIMPLE COMMANDS & PIPELINES\nA  simple command is a sequence of optional parameter assignments followed by blank-separated\nwords, with optional redirections interspersed.  For a description of assignment, see the be‐\nginning of zshparam(1).\n\nThe first word is the command to be executed, and the remaining words, if any, are  arguments\nto the command.  If a command name is given, the parameter assignments modify the environment\nof the command when it is executed.  The value of a simple command is its exit status, or 128\nplus the signal number if terminated by a signal.  For example,\n\necho foo\n\nis a simple command with arguments.\n\nA  pipeline  is  either  a simple command, or a sequence of two or more simple commands where\neach command is separated from the next by `|' or `|&'.  Where commands are separated by `|',\nthe standard output of the first command is connected to the  standard  input  of  the  next.\n`|&'  is shorthand for `2>&1 |', which connects both the standard output and the standard er‐\nror of the command to the standard input of the next.  The value of a pipeline is  the  value\nof  the  last  command, unless the pipeline is preceded by `!' in which case the value is the\nlogical inverse of the value of the last command.  For example,\n\necho foo | sed 's/foo/bar/'\n\nis a pipeline, where the output (`foo' plus a newline) of the first command will be passed to\nthe input of the second.\n\nIf a pipeline is preceded by `coproc', it is executed as a coprocess; a two-way pipe  is  es‐\ntablished between it and the parent shell.  The shell can read from or write to the coprocess\nby  means  of  the `>&p' and `<&p' redirection operators or with `print -p' and `read -p'.  A\npipeline cannot be preceded by both `coproc' and `!'.  If job  control  is  active,  the  co‐\nprocess can be treated in other than input and output as an ordinary background job.\n\nA  sublist  is  either a single pipeline, or a sequence of two or more pipelines separated by\n`&&' or `||'.  If two pipelines are separated by `&&', the second pipeline is  executed  only\nif  the  first succeeds (returns a zero status).  If two pipelines are separated by `||', the\nsecond is executed only if the first fails (returns a nonzero status).  Both  operators  have\nequal precedence and are left associative.  The value of the sublist is the value of the last\npipeline executed.  For example,\n\ndmesg | grep panic && print yes\n\nis a sublist consisting of two pipelines, the second just a simple command which will be exe‐\ncuted  if  and  only if the grep command returns a zero status.  If it does not, the value of\nthe sublist is that return status, else it is the status returned by the print  (almost  cer‐\ntainly zero).\n\nA  list  is  a sequence of zero or more sublists, in which each sublist is terminated by `;',\n`&', `&|', `&!', or a newline.  This terminator may optionally be omitted from the last  sub‐\nlist  in the list when the list appears as a complex command inside `(...)' or `{...}'.  When\na sublist is terminated by `;' or newline, the shell waits for it to finish before  executing\nthe next sublist.  If a sublist is terminated by a `&', `&|', or `&!', the shell executes the\nlast  pipeline  in it in the background, and does not wait for it to finish (note the differ‐\nence from other shells which execute the whole sublist in the  background).   A  backgrounded\npipeline returns a status of zero.\n\nMore  generally,  a list can be seen as a set of any shell commands whatsoever, including the\ncomplex commands below; this is implied wherever the word `list' appears  in  later  descrip‐\ntions.  For example, the commands in a shell function form a special sort of list.\n",
            "subsections": []
        },
        "PRECOMMAND MODIFIERS": {
            "content": "A  simple  command may be preceded by a precommand modifier, which will alter how the command\nis interpreted.  These modifiers are shell builtin commands with the exception  of  nocorrect\nwhich is a reserved word.\n\n-      The command is executed with a `-' prepended to its argv[0] string.\n",
            "subsections": [
                {
                    "name": "builtin",
                    "content": "The  command  word  is  taken to be the name of a builtin command, rather than a shell\nfunction or external command.\n\ncommand [ -pvV ]\nThe command word is taken to be the name of an external command, rather than  a  shell\nfunction or builtin.   If the POSIXBUILTINS option is set, builtins will also be exe‐\ncuted  but certain special properties of them are suppressed. The -p flag causes a de‐\nfault path to be searched instead of that in $path. With the -v flag, command is simi‐\nlar to whence and with -V, it is equivalent to whence -v.\n\nexec [ -cl ] [ -a argv0 ]\nThe following command together with any arguments is  run  in  place  of  the  current\nprocess,  rather than as a sub-process.  The shell does not fork and is replaced.  The\nshell does not invoke TRAPEXIT, nor does it source zlogout  files.   The  options  are\nprovided for compatibility with other shells.\n\nThe -c option clears the environment.\n\nThe  -l  option  is  equivalent to the - precommand modifier, to treat the replacement\ncommand as a login shell; the command is executed with a - prepended  to  its  argv[0]\nstring.  This flag has no effect if used together with the -a option.\n\nThe  -a  option is used to specify explicitly the argv[0] string (the name of the com‐\nmand as seen by the process itself) to be used by the replacement command and  is  di‐\nrectly equivalent to setting a value for the ARGV0 environment variable.\n"
                },
                {
                    "name": "nocorrect",
                    "content": "Spelling  correction  is  not  done  on any of the words.  This must appear before any\nother precommand modifier, as it is interpreted immediately,  before  any  parsing  is\ndone.  It has no effect in non-interactive shells.\n\nnoglob Filename generation (globbing) is not performed on any of the words.\n"
                }
            ]
        },
        "COMPLEX COMMANDS": {
            "content": "A complex command in zsh is one of the following:\n\nif list then list [ elif list then list ] ... [ else list ] fi\nThe  if  list is executed, and if it returns a zero exit status, the then list is exe‐\ncuted.  Otherwise, the elif list is executed and if its status is zero, the then  list\nis executed.  If each elif list returns nonzero status, the else list is executed.\n\nfor name ... [ in word ... ] term do list done\nExpand  the list of words, and set the parameter name to each of them in turn, execut‐\ning list each time.  If the `in word' is omitted, use the  positional  parameters  in‐\nstead of the words.\n\nThe  term  consists of one or more newline or ; which terminate the words, and are op‐\ntional when the `in word' is omitted.\n\nMore than one parameter name can appear before the list of  words.   If  N  names  are\ngiven,  then on each execution of the loop the next N words are assigned to the corre‐\nsponding parameters.  If there are more names than remaining words, the remaining  pa‐\nrameters  are  each set to the empty string.  Execution of the loop ends when there is\nno remaining word to assign to the first name.  It is only possible for in  to  appear\nas the first name in the list, else it will be treated as marking the end of the list.\n\nfor (( [expr1] ; [expr2] ; [expr3] )) do list done\nThe arithmetic expression expr1 is evaluated first (see the section `Arithmetic Evalu‐\nation').   The  arithmetic expression expr2 is repeatedly evaluated until it evaluates\nto zero and when non-zero, list is executed and the arithmetic expression expr3 evalu‐\nated.  If any expression is omitted, then it behaves as if it evaluated to 1.\n\nwhile list do list done\nExecute the do list as long as the while list returns a zero exit status.\n\nuntil list do list done\nExecute the do list as long as until list returns a nonzero exit status.\n\nrepeat word do list done\nword is expanded and treated as an arithmetic expression, which  must  evaluate  to  a\nnumber n.  list is then executed n times.\n\nThe repeat syntax is disabled by default when the shell starts in a mode emulating an‐\nother shell.  It can be enabled with the command `enable -r repeat'\n\ncase word in [ [(] pattern [ | pattern ] ... ) list (;;|;&|;|) ] ... esac\nExecute  the  list  associated  with the first pattern that matches word, if any.  The\nform of the patterns is the same as that used for filename generation.  See  the  sec‐\ntion `Filename Generation'.\n\nNote  further  that, unless the SHGLOB option is set, the whole pattern with alterna‐\ntives is treated by the shell as equivalent to a group of patterns within parentheses,\nalthough white space may appear about the parentheses and the vertical bar and will be\nstripped from the pattern at those points.  White space may appear  elsewhere  in  the\npattern;  this  is  not  stripped.   If  the SHGLOB option is set, so that an opening\nparenthesis can be unambiguously treated as part of the case syntax, the expression is\nparsed into separate words and these are treated as strict alternatives (as  in  other\nshells).\n\nIf  the list that is executed is terminated with ;& rather than ;;, the following list\nis also executed.  The rule for the terminator of the following list ;;, ;& or  ;|  is\napplied unless the esac is reached.\n\nIf  the  list  that  is executed is terminated with ;| the shell continues to scan the\npatterns looking for the next match, executing the corresponding  list,  and  applying\nthe  rule for the corresponding terminator ;;, ;& or ;|.  Note that word is not re-ex‐\npanded; all applicable patterns are tested with the same word.\n\nselect name [ in word ... term ] do list done\nwhere term is one or more newline or ; to terminate  the  words.   Print  the  set  of\nwords, each preceded by a number.  If the in word is omitted, use the positional para‐\nmeters.   The PROMPT3 prompt is printed and a line is read from the line editor if the\nshell is interactive and that is active, or else standard input.  If  this  line  con‐\nsists  of the number of one of the listed words, then the parameter name is set to the\nword corresponding to this number.  If this line  is  empty,  the  selection  list  is\nprinted  again.   Otherwise, the value of the parameter name is set to null.  The con‐\ntents of the line read from standard input is saved in the parameter REPLY.   list  is\nexecuted for each selection until a break or end-of-file is encountered.\n\n( list )\nExecute  list in a subshell.  Traps set by the trap builtin are reset to their default\nvalues while executing list; an exception is that ignored signals will continue to  be\nignored if the option POSIXTRAPS is set.\n\n{ list }\nExecute list.\n\n{ try-list } always { always-list }\nFirst  execute  try-list.  Regardless of errors, or break or continue commands encoun‐\ntered within try-list, execute always-list.  Execution then continues from the  result\nof  the execution of try-list; in other words, any error, or break or continue command\nis treated in the normal way, as if always-list were not present.  The two  chunks  of\ncode are referred to as the `try block' and the `always block'.\n\nOptional  newlines or semicolons may appear after the always; note, however, that they\nmay not appear between the preceding closing brace and the always.\n\nAn `error' in this context is a condition such as a  syntax  error  which  causes  the\nshell  to abort execution of the current function, script, or list.  Syntax errors en‐\ncountered while the shell is parsing the code do not cause the always-list to be  exe‐\ncuted.   For  example, an erroneously constructed if block in try-list would cause the\nshell to abort during parsing, so that always-list would not be executed, while an er‐\nroneous substitution such as ${*foo*} would cause a run-time error,  after  which  al‐\nways-list would be executed.\n\nAn  error  condition  can  be  tested  and  reset  with  the  special integer variable\nTRYBLOCKERROR.  Outside an always-list the value  is  irrelevant,  but  it  is  ini‐\ntialised  to  -1.   Inside  always-list,  the  value  is 1 if an error occurred in the\ntry-list, else 0.  If TRYBLOCKERROR is set to 0 during the  always-list,  the  error\ncondition  caused by the try-list is reset, and shell execution continues normally af‐\nter the end of always-list.  Altering the value during the try-list is not useful (un‐\nless this forms part of an enclosing always block).\n\nRegardless of TRYBLOCKERROR, after the end of always-list the normal shell status $?\nis the value returned from try-list.  This will be non-zero if  there  was  an  error,\neven if TRYBLOCKERROR was set to zero.\n\nThe  following executes the given code, ignoring any errors it causes.  This is an al‐\nternative to the usual convention of protecting code by executing it in a subshell.\n\n{\n# code which may cause an error\n} always {\n# This code is executed regardless of the error.\n(( TRYBLOCKERROR = 0 ))\n}\n# The error condition has been reset.\n\nWhen a try block occurs outside of any function, a return or  a  exit  encountered  in\ntry-list  does not cause the execution of always-list.  Instead, the shell exits imme‐\ndiately after any EXIT trap has been executed.  Otherwise, a  return  command  encoun‐\ntered  in  try-list  will cause the execution of always-list, just like break and con‐\ntinue.\n\nfunction [ -T ] word ... [ () ] [ term ] { list }\nword ... () [ term ] { list }\nword ... () [ term ] command\nwhere term is one or more newline or ;.  Define a function which is referenced by  any\none  of  word.   Normally,  only one word is provided; multiple words are usually only\nuseful for setting traps.  The body of the function is the list between the {  and  }.\nSee the section `Functions'.\n\nThe options of function have the following meanings:\n\n-T     Enable  tracing  for this function, as though with functions -T.  See the docu‐\nmentation of the -f option to the typeset builtin, in zshbuiltins(1).\n\nIf the option SHGLOB is set for compatibility with other shells, then whitespace  may\nappear between the left and right parentheses when there is a single word;  otherwise,\nthe parentheses will be treated as forming a globbing pattern in that case.\n\nIn any of the forms above, a redirection may appear outside the function body, for ex‐\nample\n\nfunc() { ... } 2>&1\n\nThe  redirection is stored with the function and applied whenever the function is exe‐\ncuted.  Any variables in the redirection are expanded at the point the function is ex‐\necuted, but outside the function scope.\n\ntime [ pipeline ]\nThe pipeline is executed, and timing statistics are reported on the standard error  in\nthe form specified by the TIMEFMT parameter.  If pipeline is omitted, print statistics\nabout the shell process and its children.\n\n[[ exp ]]\nEvaluates  the conditional expression exp and return a zero exit status if it is true.\nSee the section `Conditional Expressions' for a description of exp.\n",
            "subsections": []
        },
        "ALTERNATE FORMS FOR COMPLEX COMMANDS": {
            "content": "Many of zsh's complex commands have alternate forms.  These are non-standard and  are  likely\nnot  to  be obvious even to seasoned shell programmers; they should not be used anywhere that\nportability of shell code is a concern.\n\nThe short versions below only work if sublist is of the form `{ list }' or if the SHORTLOOPS\noption is set.  For the if, while and until commands, in both these cases the  test  part  of\nthe loop must also be suitably delimited, such as by `[[ ... ]]' or `(( ... ))', else the end\nof  the  test  will not be recognized.  For the for, repeat, case and select commands no such\nspecial form for the arguments is necessary, but the other condition  (the  special  form  of\nsublist  or  use of the SHORTLOOPS option) still applies.  The SHORTREPEAT option is avail‐\nable to enable the short version only for the repeat command.\n\nif list { list } [ elif list { list } ] ... [ else { list } ]\nAn alternate form of if.  The rules mean that\n\nif [[ -o ignorebraces ]] {\nprint yes\n}\n\nworks, but\n\nif true {  # Does not work!\nprint yes\n}\n\ndoes not, since the test is not suitably delimited.\n\nif list sublist\nA short form of the alternate if.  The same limitations on the form of list  apply  as\nfor the previous form.\n\nfor name ... ( word ... ) sublist\nA short form of for.\n\nfor name ... [ in word ... ] term sublist\nwhere term is at least one newline or ;.  Another short form of for.\n\nfor (( [expr1] ; [expr2] ; [expr3] )) sublist\nA short form of the arithmetic for command.\n\nforeach name ... ( word ... ) list end\nAnother form of for.\n\nwhile list { list }\nAn  alternative  form  of  while.   Note the limitations on the form of list mentioned\nabove.\n\nuntil list { list }\nAn alternative form of until.  Note the limitations on  the  form  of  list  mentioned\nabove.\n\nrepeat word sublist\nThis is a short form of repeat.\n\ncase word { [ [(] pattern [ | pattern ] ... ) list (;;|;&|;|) ] ... }\nAn alternative form of case.\n\nselect name [ in word ... term ] sublist\nwhere term is at least one newline or ;.  A short form of select.\n\nfunction word ... [ () ] [ term ] sublist\nThis is a short form of function.\n",
            "subsections": []
        },
        "RESERVED WORDS": {
            "content": "The following words are recognized as reserved words when used as the first word of a command\nunless quoted or disabled using disable -r:\n",
            "subsections": [
                {
                    "name": "do done esac then elif else fi for case if while function repeat time until select coproc no‐",
                    "content": ""
                },
                {
                    "name": "correct foreach end ! [[ { } declare export float integer local readonly typeset",
                    "content": "Additionally,  `}'  is recognized in any position if neither the IGNOREBRACES option nor the\nIGNORECLOSEBRACES option is set.\n"
                }
            ]
        },
        "ERRORS": {
            "content": "Certain errors are treated as fatal by the shell: in an interactive shell, they cause control\nto return to the command line, and in a non-interactive shell they  cause  the  shell  to  be\naborted.   In older versions of zsh, a non-interactive shell running a script would not abort\ncompletely, but would resume execution at the next command to be read from the script,  skip‐\nping  the  remainder  of  any functions or shell constructs such as loops or conditions; this\nsomewhat illogical behaviour can be recovered by setting the option CONTINUEONERROR.\n\nFatal errors found in non-interactive shells include:\n\n•      Failure to parse shell options passed when invoking the shell\n\n•      Failure to change options with the set builtin\n\n•      Parse errors of all sorts, including failures to parse mathematical expressions\n\n•      Failures to set or modify variable behaviour with typeset, local, declare, export, in‐\nteger, float\n\n•      Execution of incorrectly positioned loop control structures (continue, break)\n\n•      Attempts to use regular expression with no regular expression module available\n\n•      Disallowed operations when the RESTRICTED options is set\n\n•      Failure to create a pipe needed for a pipeline\n\n•      Failure to create a multio\n\n•      Failure to autoload a module needed for a declared shell feature\n\n•      Errors creating command or process substitutions\n\n•      Syntax errors in glob qualifiers\n\n•      File generation errors where not caught by the option BADPATTERN\n\n•      All bad patterns used for matching within case statements\n\n•      File generation failures where not caused by NOMATCH or similar options\n\n•      All file generation errors where the pattern was used to create a multio\n\n•      Memory errors where detected by the shell\n\n•      Invalid subscripts to shell variables\n\n•      Attempts to assign read-only variables\n\n•      Logical errors with variables such as assignment to the wrong type\n\n•      Use of invalid variable names\n\n•      Errors in variable substitution syntax\n\n•      Failure to convert characters in $'...' expressions\n\nIf the POSIXBUILTINS option is set, more errors associated with shell builtin  commands  are\ntreated as fatal, as specified by the POSIX standard.\n",
            "subsections": []
        },
        "COMMENTS": {
            "content": "In non-interactive shells, or in interactive shells with the INTERACTIVECOMMENTS option set,\na  word beginning with the third character of the histchars parameter (`#' by default) causes\nthat word and all the following characters up to a newline to be ignored.\n",
            "subsections": []
        },
        "ALIASING": {
            "content": "Every eligible word in the shell input is checked to see if there is an alias defined for it.\nIf so, it is replaced by the text of the alias if it is in command position (if it  could  be\nthe first word of a simple command), or if the alias is global.  If the replacement text ends\nwith  a  space, the next word in the shell input is always eligible for purposes of alias ex‐\npansion.\n\nIt is an error for the function name, word, in the sh-compatible function  definition  syntax\n`word  () ...' to be a word that resulted from alias expansion, unless the ALIASFUNCDEF op‐\ntion is set.\n\nAn alias is defined using the alias builtin; global aliases may be defined using the  -g  op‐\ntion to that builtin.\n\nA word is defined as:\n\n•      Any plain string or glob pattern\n\n•      Any  quoted string, using any quoting method (note that the quotes must be part of the\nalias definition for this to be eligible)\n\n•      Any parameter reference or command substitution\n\n•      Any series of the foregoing, concatenated without whitespace or other  tokens  between\nthem\n\n•      Any reserved word (case, do, else, etc.)\n\n•      With  global aliasing, any command separator, any redirection operator, and `(' or `)'\nwhen not part of a glob pattern\n\nAlias expansion is done on the shell input before any other expansion except  history  expan‐\nsion.   Therefore, if an alias is defined for the word foo, alias expansion may be avoided by\nquoting part of the word, e.g. \\foo.  Any form of quoting works, although there is nothing to\nprevent an alias being defined for the quoted form such as \\foo as well.\n\nIn particular, note that quoting must be used when using unalias to remove global aliases:\n\n% alias -g foo=bar\n% unalias foo\nunalias: no such hash table element: bar\n% unalias \\foo\n%\n\nWhen POSIXALIASES is set, only plain unquoted strings are eligible for aliasing.  The  alias\nbuiltin does not reject ineligible aliases, but they are not expanded.\n\nFor use with completion, which would remove an initial backslash followed by a character that\nisn't  special,  it may be more convenient to quote the word by starting with a single quote,\ni.e. 'foo; completion will automatically add the trailing single quote.\n",
            "subsections": [
                {
                    "name": "Alias difficulties",
                    "content": "Although aliases can be used in ways that bend normal  shell  syntax,  not  every  string  of\nnon-white-space characters can be used as an alias.\n\nAny  set  of characters not listed as a word above is not a word, hence no attempt is made to\nexpand it as an alias, no matter how it is defined (i.e. via the builtin or the special para‐\nmeter aliases described in the section THE ZSH/PARAMETER MODULE in zshmodules(1)).   However,\nas noted in the case of POSIXALIASES above, the shell does not attempt to deduce whether the\nstring corresponds to a word at the time the alias is created.\n\nFor  example,  an  expression containing an = at the start of a command line is an assignment\nand cannot be expanded as an alias; a lone = is not an assignment but can only be set  as  an\nalias using the parameter, as otherwise the = is taken part of the syntax of the builtin com‐\nmand.\n\nIt  is not presently possible to alias the `((' token that introduces arithmetic expressions,\nbecause until a full statement has been parsed, it cannot be distinguished from two  consecu‐\ntive  `('  tokens  introducing nested subshells.  Also, if a separator such as && is aliased,\n\\&& turns into the two tokens \\& and &, each of which may have been aliased separately.  Sim‐\nilarly for \\<<, \\>|, etc.\n\nThere is a commonly encountered problem with aliases illustrated by the following code:\n\nalias echobar='echo bar'; echobar\n\nThis prints a message that the command echobar could not  be  found.   This  happens  because\naliases  are  expanded  when  the code is read in; the entire line is read in one go, so that\nwhen echobar is executed it is too late to expand the newly defined alias.  This is  often  a\nproblem  in  shell scripts, functions, and code executed with `source' or `.'.  Consequently,\nuse of functions rather than aliases is recommended in non-interactive code.\n"
                }
            ]
        },
        "QUOTING": {
            "content": "A character may be quoted (that is, made to stand for itself) by preceding  it  with  a  `\\'.\n`\\' followed by a newline is ignored.\n\nA  string  enclosed between `$'' and `'' is processed the same way as the string arguments of\nthe print builtin, and the resulting string is considered to be entirely quoted.   A  literal\n`'' character can be included in the string by using the `\\'' escape.\n\nAll  characters  enclosed  between a pair of single quotes ('') that is not preceded by a `$'\nare quoted.  A single quote cannot appear within single quotes unless the option RCQUOTES is\nset, in which case a pair of single quotes are turned into a single quote.  For example,\n\nprint ''''\n\noutputs nothing apart from a newline if RCQUOTES is not set, but one single quote if  it  is\nset.\n\nInside double quotes (\"\"), parameter and command substitution occur, and `\\' quotes the char‐\nacters `\\', ``', `\"', `$', and the first character of $histchars (default `!').\n",
            "subsections": []
        },
        "REDIRECTION": {
            "content": "If  a command is followed by & and job control is not active, then the default standard input\nfor the command is the empty file /dev/null.  Otherwise, the environment for the execution of\na command contains the file descriptors of the invoking shell  as  modified  by  input/output\nspecifications.\n\nThe following may appear anywhere in a simple command or may precede or follow a complex com‐\nmand.  Expansion occurs before word or digit is used except as noted below.  If the result of\nsubstitution  on  word  produces more than one filename, redirection occurs for each separate\nfilename in turn.\n\n< word Open file word for reading as standard input.  It is an error to open a file  in  this\nfashion if it does not exist.\n\n<> word\nOpen  file word for reading and writing as standard input.  If the file does not exist\nthen it is created.\n\n> word Open file word for writing as standard output.  If the file does not exist then it  is\ncreated.   If  the file exists, and the CLOBBER option is unset, this causes an error;\notherwise, it is truncated to zero length.\n\n>| word\n>! word\nSame as >, except that the file is truncated to zero length if it  exists,  regardless\nof CLOBBER.\n\n>> word\nOpen  file  word  for writing in append mode as standard output.  If the file does not\nexist, and the CLOBBER and APPENDCREATE options are both unset, this causes an error;\notherwise, the file is created.\n\n>>| word\n>>! word\nSame as >>, except that the file is created if it does not exist, regardless of  CLOB‐\nBER and APPENDCREATE.\n\n<<[-] word\nThe  shell  input is read up to a line that is the same as word, or to an end-of-file.\nNo parameter expansion, command substitution or filename generation  is  performed  on\nword.  The resulting document, called a here-document, becomes the standard input.\n\nIf any character of word is quoted with single or double quotes or a `\\', no interpre‐\ntation  is  placed upon the characters of the document.  Otherwise, parameter and com‐\nmand substitution occurs, `\\' followed by a newline is removed, and `\\' must  be  used\nto quote the characters `\\', `$', ``' and the first character of word.\n\nNote  that  word  itself  does not undergo shell expansion.  Backquotes in word do not\nhave their usual effect; instead they behave similarly to double quotes,  except  that\nthe  backquotes  themselves  are passed through unchanged.  (This information is given\nfor completeness and it is not recommended that backquotes be used.)   Quotes  in  the\nform  $'...' have their standard effect of expanding backslashed references to special\ncharacters.\n\nIf <<- is used, then all leading tabs are stripped from word and from the document.\n\n<<< word\nPerform shell expansion on word and pass the result to standard input.  This is  known\nas  a  here-string.   Compare the use of word in here-documents above, where word does\nnot undergo shell expansion.  The result will have a trailing newline after it.\n\n<& number\n>& number\nThe standard input/output is duplicated from file descriptor number (see dup2(2)).\n",
            "subsections": [
                {
                    "name": "<& -",
                    "content": ">& -   Close the standard input/output.\n"
                },
                {
                    "name": "<& p",
                    "content": ">& p   The input/output from/to the coprocess is moved to the standard input/output.\n\n>& word\n&> word\n(Except where `>& word' matches one of the above syntaxes; `&>' can always be used  to\navoid  this  ambiguity.)   Redirects both standard output and standard error (file de‐\nscriptor 2) in the manner of `> word'.  Note that this does not have the  same  effect\nas `> word 2>&1' in the presence of multios (see the section below).\n\n>&| word\n>&! word\n&>| word\n&>! word\nRedirects both standard output and standard error (file descriptor 2) in the manner of\n`>| word'.\n\n>>& word\n&>> word\nRedirects both standard output and standard error (file descriptor 2) in the manner of\n`>> word'.\n\n>>&| word\n>>&! word\n&>>| word\n&>>! word\nRedirects both standard output and standard error (file descriptor 2) in the manner of\n`>>| word'.\n\nIf  one  of  the  above  is preceded by a digit, then the file descriptor referred to is that\nspecified by the digit instead of the default 0 or 1.  The order in  which  redirections  are\nspecified  is  significant.   The  shell evaluates each redirection in terms of the (file de‐\nscriptor, file) association at the time of evaluation.  For example:\n\n... 1>fname 2>&1\n\nfirst associates file descriptor 1 with file fname.  It then  associates  file  descriptor  2\nwith  the  file associated with file descriptor 1 (that is, fname).  If the order of redirec‐\ntions were reversed, file descriptor 2 would be associated with the terminal  (assuming  file\ndescriptor 1 had been) and then file descriptor 1 would be associated with file fname.\n\nThe `|&' command separator described in Simple Commands & Pipelines in zshmisc(1) is a short‐\nhand for `2>&1 |'.\n\nThe  various  forms of process substitution, `<(list)', and `=(list)' for input and `>(list)'\nfor output, are often used together with redirection.  For example,  if  word  in  an  output\nredirection  is  of the form `>(list)' then the output is piped to the command represented by\nlist.  See Process Substitution in zshexpn(1).\n"
                }
            ]
        },
        "OPENING FILE DESCRIPTORS USING PARAMETERS": {
            "content": "When the shell is parsing arguments to a command, and the shell option IGNOREBRACES  is  not\nset, a different form of redirection is allowed: instead of a digit before the operator there\nis  a  valid  shell identifier enclosed in braces.  The shell will open a new file descriptor\nthat is guaranteed to be at least 10 and set the parameter named by  the  identifier  to  the\nfile  descriptor opened.  No whitespace is allowed between the closing brace and the redirec‐\ntion character.  For example:\n\n... {myfd}>&1\n\nThis opens a new file descriptor that is a duplicate of file descriptor 1 and sets the  para‐\nmeter myfd to the number of the file descriptor, which will be at least 10.  The new file de‐\nscriptor  can  be  written  to using the syntax >&$myfd.  The file descriptor remains open in\nsubshells and forked external executables.\n\nThe syntax {varid}>&-, for example {myfd}>&-, may be used to close a file  descriptor  opened\nin this fashion.  Note that the parameter given by varid must previously be set to a file de‐\nscriptor in this case.\n\nIt is an error to open or close a file descriptor in this fashion when the parameter is read‐\nonly.   However,  it  is  not  an  error to read or write a file descriptor using <&$param or\n>&$param if param is readonly.\n\nIf the option CLOBBER is unset, it is an error to open a file descriptor  using  a  parameter\nthat  is  already set to an open file descriptor previously allocated by this mechanism.  Un‐\nsetting the parameter before using it for allocating a file descriptor avoids the error.\n\nNote that this mechanism merely allocates or closes a file descriptor; it  does  not  perform\nany redirections from or to it.  It is usually convenient to allocate a file descriptor prior\nto use as an argument to exec.  The syntax does not in any case work when used around complex\ncommands  such as parenthesised subshells or loops, where the opening brace is interpreted as\npart of a command list to be executed in the current shell.\n\nThe following shows a typical sequence of allocation, use, and closing of a file descriptor:\n\ninteger myfd\nexec {myfd}>~/logs/mylogfile.txt\nprint This is a log message. >&$myfd\nexec {myfd}>&-\n\nNote that the expansion of the variable in the expression >&$myfd occurs  at  the  point  the\nredirection  is opened.  This is after the expansion of command arguments and after any redi‐\nrections to the left on the command line have been processed.\n",
            "subsections": []
        },
        "MULTIOS": {
            "content": "If the user tries to open a file descriptor for writing more than once, the shell  opens  the\nfile  descriptor  as  a pipe to a process that copies its input to all the specified outputs,\nsimilar to tee, provided the MULTIOS option is set, as it is by default.  Thus:\n\ndate >foo >bar\n\nwrites the date to two files, named `foo' and `bar'.  Note that a pipe is an  implicit  redi‐\nrection; thus\n\ndate >foo | cat\n\nwrites the date to the file `foo', and also pipes it to cat.\n\nNote  that the shell opens all the files to be used in the multio process immediately, not at\nthe point they are about to be written.\n\nNote also that redirections are always expanded in order.  This  happens  regardless  of  the\nsetting  of  the  MULTIOS  option,  but with the option in effect there are additional conse‐\nquences. For example, the meaning of the expression >&1 will change after a previous redirec‐\ntion:\n\ndate >&1 >output\n\nIn the case above, the >&1 refers to the standard output at the start of the line; the result\nis similar to the tee command.  However, consider:\n\ndate >output >&1\n\nAs redirections are evaluated in order, when the >&1 is encountered the  standard  output  is\nset  to  the file output and another copy of the output is therefore sent to that file.  This\nis unlikely to be what is intended.\n\nIf the MULTIOS option is set, the word after a redirection  operator  is  also  subjected  to\nfilename generation (globbing).  Thus\n\n: > *\n\nwill  truncate  all  files in the current directory, assuming there's at least one.  (Without\nthe MULTIOS option, it would create an empty file called `*'.)  Similarly, you can do\n\necho exit 0 >> *.sh\n\nIf the user tries to open a file descriptor for reading more than once, the shell  opens  the\nfile  descriptor as a pipe to a process that copies all the specified inputs to its output in\nthe order specified, provided the MULTIOS option is set.  It should be noted that  each  file\nis  opened immediately, not at the point where it is about to be read: this behaviour differs\nfrom cat, so if strictly standard behaviour is needed, cat should be used instead.\n\nThus\n\nsort <foo <fubar\n\nor even\n\nsort <f{oo,ubar}\n\nis equivalent to `cat foo fubar | sort'.\n\nExpansion of the redirection argument occurs at the point the redirection is opened,  at  the\npoint described above for the expansion of the variable in >&$myfd.\n\nNote that a pipe is an implicit redirection; thus\n\ncat bar | sort <foo\n\nis equivalent to `cat bar foo | sort' (note the order of the inputs).\n\nIf  the  MULTIOS option is unset, each redirection replaces the previous redirection for that\nfile descriptor.  However, all files redirected to are actually opened, so\n\necho Hello > bar > baz\n\nwhen MULTIOS is unset will truncate `bar', and write `Hello' into `baz'.\n\nThere is a problem when an output multio is attached to an external program.  A simple  exam‐\nple shows this:\n\ncat file >file1 >file2\ncat file1 file2\n\nHere,  it  is  possible that the second `cat' will not display the full contents of file1 and\nfile2 (i.e. the original contents of file repeated twice).\n\nThe reason for this is that the multios are spawned after the cat process is forked from  the\nparent shell, so the parent shell does not wait for the multios to finish writing data.  This\nmeans  the  command  as  shown  can exit before file1 and file2 are completely written.  As a\nworkaround, it is possible to run the cat process as part of a job in the current shell:\n\n{ cat file } >file >file2\n\nHere, the {...} job will pause to wait for both files to be written.\n",
            "subsections": []
        },
        "REDIRECTIONS WITH NO COMMAND": {
            "content": "When a simple command consists of one or more redirection operators and zero or more  parame‐\nter assignments, but no command name, zsh can behave in several ways.\n\nIf  the  parameter  NULLCMD  is not set or the option CSHNULLCMD is set, an error is caused.\nThis is the csh behavior and CSHNULLCMD is set by default when emulating csh.\n\nIf the option SHNULLCMD is set, the builtin `:' is inserted as  a  command  with  the  given\nredirections.  This is the default when emulating sh or ksh.\n\nOtherwise,  if  the  parameter  NULLCMD  is set, its value will be used as a command with the\ngiven redirections.  If both NULLCMD and READNULLCMD are set, then the value  of  the  latter\nwill be used instead of that of the former when the redirection is an input.  The default for\nNULLCMD is `cat' and for READNULLCMD is `more'. Thus\n\n< file\n\nshows  the  contents  of file on standard output, with paging if that is a terminal.  NULLCMD\nand READNULLCMD may refer to shell functions.\n",
            "subsections": []
        },
        "COMMAND EXECUTION": {
            "content": "If a command name contains no slashes, the shell attempts to locate it.  If  there  exists  a\nshell function by that name, the function is invoked as described in the section `Functions'.\nIf there exists a shell builtin by that name, the builtin is invoked.\n\nOtherwise,  the shell searches each element of $path for a directory containing an executable\nfile by that name.\n\nIf execution fails: an error message is printed, and one of the following values is returned.\n\n127    The search was unsuccessful.  The error message is `command not found: cmd'.\n126    The executable file has insufficient permissions, is a directory or special  file,  or\nis  not  a  script and is in a format unrecognized by the operating system.  The exact\nconditions and error message are operating system-dependent; see execve(2).\n\nIf execution fails because the file is not in executable format, and the file is not a direc‐\ntory, it is assumed to be a shell script.  /bin/sh is spawned to execute it.  If the  program\nis  a  file beginning with `#!', the remainder of the first line specifies an interpreter for\nthe program.  The shell will execute the specified interpreter on operating systems  that  do\nnot handle this executable format in the kernel.\n\nIf no external command is found but a function commandnotfoundhandler exists the shell ex‐\necutes  this function with all command line arguments.  The return status of the function be‐\ncomes the status of the command.  Note that the handler is executed in a subshell  forked  to\nexecute an external command, hence changes to directories, shell parameters, etc. have no ef‐\nfect on the main shell.\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "Shell  functions  are defined with the function reserved word or the special syntax `funcname\n()'.  Shell functions are read in and stored internally.  Alias names are resolved  when  the\nfunction  is  read.   Functions are executed like commands with the arguments passed as posi‐\ntional parameters.  (See the section `Command Execution'.)\n\nFunctions execute in the same process as the caller and share all files and  present  working\ndirectory  with the caller.  A trap on EXIT set inside a function is executed after the func‐\ntion completes in the environment of the caller.\n\nThe return builtin is used to return from function calls.\n\nFunction identifiers can be listed with the functions builtin.  Functions  can  be  undefined\nwith the unfunction builtin.\n",
            "subsections": []
        },
        "AUTOLOADING FUNCTIONS": {
            "content": "A function can be marked as undefined using the autoload builtin (or `functions -u' or `type‐\nset  -fu').   Such  a  function  has no body.  When the function is first executed, the shell\nsearches for its definition using the elements of the fpath variable.  Thus to  define  func‐\ntions for autoloading, a typical sequence is:\n\nfpath=(~/myfuncs $fpath)\nautoload myfunc1 myfunc2 ...\n\nThe  usual  alias  expansion during reading will be suppressed if the autoload builtin or its\nequivalent is given the option -U. This is recommended for the use of functions supplied with\nthe zsh distribution.  Note that for functions precompiled with the zcompile builtin  command\nthe  flag -U must be provided when the .zwc file is created, as the corresponding information\nis compiled into the latter.\n\nFor each element in fpath, the shell looks for three possible files, the newest of  which  is\nused to load the definition for the function:\n\nelement.zwc\nA file created with the zcompile builtin command, which is expected to contain the de‐\nfinitions  for  all  functions in the directory named element.  The file is treated in\nthe same manner as a directory containing files for functions and is searched for  the\ndefinition of the function.   If the definition is not found, the search for a defini‐\ntion proceeds with the other two possibilities described below.\n\nIf  element already includes a .zwc extension (i.e. the extension was explicitly given\nby the user), element is searched for the definition of the function without comparing\nits age to that of other files; in fact, there does not need to be any directory named\nelement without the suffix.  Thus including an element such as  `/usr/local/funcs.zwc'\nin  fpath will speed up the search for functions, with the disadvantage that functions\nincluded must be explicitly recompiled by hand before the shell notices any changes.\n\nelement/function.zwc\nA file created with zcompile, which is expected to contain the  definition  for  func‐\ntion.  It may include other function definitions as well, but those are neither loaded\nnor  executed;  a  file found in this way is searched only for the definition of func‐\ntion.\n\nelement/function\nA file of zsh command text, taken to be the definition for function.\n\nIn summary, the order of searching is, first, in the parents of directories in fpath for  the\nnewer  of  either  a  compiled directory or a directory in fpath; second, if more than one of\nthese contains a definition for the function that is sought, the leftmost  in  the  fpath  is\nchosen; and third, within a directory, the newer of either a compiled function or an ordinary\nfunction definition is used.\n\nIf the KSHAUTOLOAD option is set, or the file contains only a simple definition of the func‐\ntion,  the file's contents will be executed.  This will normally define the function in ques‐\ntion, but may also perform initialization, which is executed in the context of  the  function\nexecution,  and may therefore define local parameters.  It is an error if the function is not\ndefined by loading the file.\n\nOtherwise, the function body (with no surrounding `funcname() {...}') is taken to be the com‐\nplete contents of the file.  This form allows the file to be used directly as  an  executable\nshell  script.  If processing of the file results in the function being re-defined, the func‐\ntion itself is not re-executed.  To force the shell to perform initialization and  then  call\nthe  function  defined,  the  file should contain initialization code (which will be executed\nthen discarded) in addition to a complete function definition (which  will  be  retained  for\nsubsequent calls to the function), and a call to the shell function, including any arguments,\nat the end.\n\nFor example, suppose the autoload file func contains\n\nfunc() { print This is func; }\nprint func is initialized\n\nthen  `func;  func'  with  KSHAUTOLOAD set will produce both messages on the first call, but\nonly the message `This is func' on the second and  subsequent  calls.   Without  KSHAUTOLOAD\nset,  it  will produce the initialization message on the first call, and the other message on\nthe second and subsequent calls.\n\nIt is also possible to create a function that is not marked as autoloaded,  but  which  loads\nits  own  definition by searching fpath, by using `autoload -X' within a shell function.  For\nexample, the following are equivalent:\n\nmyfunc() {\nautoload -X\n}\nmyfunc args...\n\nand\n\nunfunction myfunc   # if myfunc was defined\nautoload myfunc\nmyfunc args...\n\nIn fact, the functions command outputs `builtin autoload -X' as the  body  of  an  autoloaded\nfunction.  This is done so that\n\neval \"$(functions)\"\n\nproduces  a  reasonable result.  A true autoloaded function can be identified by the presence\nof the comment `# undefined' in the body, because all comments  are  discarded  from  defined\nfunctions.\n\nTo load the definition of an autoloaded function myfunc without executing myfunc, use:\n\nautoload +X myfunc\n",
            "subsections": []
        },
        "ANONYMOUS FUNCTIONS": {
            "content": "If  no name is given for a function, it is `anonymous' and is handled specially.  Either form\nof function definition may be used: a `()' with no preceding name, or a  `function'  with  an\nimmediately following open brace.  The function is executed immediately at the point of defi‐\nnition and is not stored for future use.  The function name is set to `(anon)'.\n\nArguments  to the function may be specified as words following the closing brace defining the\nfunction, hence if there are none no arguments (other than $0) are set.  This is a difference\nfrom the way other functions are parsed: normal function definitions may be followed by  cer‐\ntain  keywords  such as `else' or `fi', which will be treated as arguments to anonymous func‐\ntions, so that a newline or semicolon is needed to force keyword interpretation.\n\nNote also that the argument list of any enclosing script or function is hidden (as  would  be\nthe case for any other function called at this point).\n\nRedirections  may  be  applied  to  the  anonymous  function  in the same manner as to a cur‐\nrent-shell structure enclosed in braces.  The main use of anonymous functions is to provide a\nscope for local variables.  This is particularly convenient in start-up files as these do not\nprovide their own local variable scope.\n\nFor example,\n\nvariable=outside\nfunction {\nlocal variable=inside\nprint \"I am $variable with arguments $*\"\n} this and that\nprint \"I am $variable\"\n\noutputs the following:\n\nI am inside with arguments this and that\nI am outside\n\nNote that function definitions with arguments that expand to  nothing,  for  example  `name=;\nfunction  $name  { ... }', are not treated as anonymous functions.  Instead, they are treated\nas normal function definitions where the definition is silently discarded.\n",
            "subsections": []
        },
        "SPECIAL FUNCTIONS": {
            "content": "Certain functions, if defined, have special meaning to the shell.\n",
            "subsections": [
                {
                    "name": "Hook Functions",
                    "content": "For the functions below, it is possible to define an array that has  the  same  name  as  the\nfunction  with `functions' appended.  Any element in such an array is taken as the name of a\nfunction to execute; it is executed in the same context and with the same arguments and  same\ninitial  value  of  $?   as the basic function.  For example, if $chpwdfunctions is an array\ncontaining the values `mychpwd', `chpwdsavedirstack', then the shell  attempts  to  execute\nthe functions `chpwd', `mychpwd' and `chpwdsavedirstack', in that order.  Any function that\ndoes  not exist is silently ignored.  A function found by this mechanism is referred to else‐\nwhere as a hook function.  An error in any function causes subsequent  functions  not  to  be\nrun.   Note  further  that an error in a precmd hook causes an immediately following periodic\nfunction not to run (though it may run at the next opportunity).\n\nchpwd  Executed whenever the current working directory is changed.\n"
                },
                {
                    "name": "periodic",
                    "content": "If the parameter PERIOD is set, this function is executed every $PERIOD seconds,  just\nbefore  a  prompt.   Note that if multiple functions are defined using the array peri‐\nodicfunctions only one period is applied to the complete set of  functions,  and  the\nscheduled  time  is  not  reset if the list of functions is altered.  Hence the set of\nfunctions is always called together.\n\nprecmd Executed before each prompt.  Note that precommand functions are not re-executed  sim‐\nply  because the command line is redrawn, as happens, for example, when a notification\nabout an exiting job is displayed.\n"
                },
                {
                    "name": "preexec",
                    "content": "Executed just after a command has been read and is about to be executed.  If the  his‐\ntory  mechanism  is active (regardless of whether the line was discarded from the his‐\ntory buffer), the string that the user typed is passed as the first  argument,  other‐\nwise  it  is an empty string.  The actual command that will be executed (including ex‐\npanded aliases) is passed in two different  forms:  the  second  argument  is  a  sin‐\ngle-line,  size-limited  version  of  the  command  (with  things like function bodies\nelided); the third argument contains the full text that is being executed.\n"
                },
                {
                    "name": "zshaddhistory",
                    "content": "Executed when a history line has been read interactively, but before it  is  executed.\nThe  sole  argument is the complete history line (so that any terminating newline will\nstill be present).\n\nIf any of the hook functions returns status 1 (or any non-zero  value  other  than  2,\nthough  this is not guaranteed for future versions of the shell) the history line will\nnot be saved, although it lingers in the history until the next line is executed,  al‐\nlowing you to reuse or edit it immediately.\n\nIf  any  of  the hook functions returns status 2 the history line will be saved on the\ninternal history list, but not written to the history file.  In case  of  a  conflict,\nthe first non-zero status value is taken.\n\nA hook function may call `fc -p ...' to switch the history context so that the history\nis saved in a different file from that in the global HISTFILE parameter.  This is han‐\ndled  specially: the history context is automatically restored after the processing of\nthe history line is finished.\n\nThe following example function works with one of  the  options  INCAPPENDHISTORY  or\nSHAREHISTORY set, in order that the line is written out immediately after the history\nentry is added.  It first adds the history line to the normal history with the newline\nstripped,  which  is usually the correct behaviour.  Then it switches the history con‐\ntext so that the line will be written to a history file in the current directory.\n\nzshaddhistory() {\nprint -sr -- ${1%%$'\\n'}\nfc -p .zshlocalhistory\n}\n"
                },
                {
                    "name": "zshexit",
                    "content": "Executed at the point where the main shell is about to exit  normally.   This  is  not\ncalled  by  exiting subshells, nor when the exec precommand modifier is used before an\nexternal command.  Also, unlike TRAPEXIT, it is not called when functions exit.\n"
                },
                {
                    "name": "Trap Functions",
                    "content": "The functions below are treated specially but do not have corresponding hook arrays.\n\nTRAPNAL\nIf defined and non-null, this function will be executed whenever the shell  catches  a\nsignal SIGNAL, where NAL is a signal name as specified for the kill builtin.  The sig‐\nnal number will be passed as the first parameter to the function.\n\nIf  a function of this form is defined and null, the shell and processes spawned by it\nwill ignore SIGNAL.\n\nThe return status from the function is handled specially.  If it is zero,  the  signal\nis  assumed  to  have  been handled, and execution continues normally.  Otherwise, the\nshell will behave as interrupted except that the return status  of  the  trap  is  re‐\ntained.\n\nPrograms  terminated by uncaught signals typically return the status 128 plus the sig‐\nnal number.  Hence the following causes the handler for SIGINT  to  print  a  message,\nthen mimic the usual effect of the signal.\n\nTRAPINT() {\nprint \"Caught SIGINT, aborting.\"\nreturn $(( 128 + $1 ))\n}\n\nThe functions TRAPZERR, TRAPDEBUG and TRAPEXIT are never executed inside other traps.\n\nTRAPDEBUG\nIf the option DEBUGBEFORECMD is set (as it is by default), executed before each com‐\nmand;  otherwise executed after each command.  See the description of the trap builtin\nin zshbuiltins(1) for details of additional features provided in debug traps.\n\nTRAPEXIT\nExecuted when the shell exits, or when the current function exits if defined inside  a\nfunction.   The  value of $? at the start of execution is the exit status of the shell\nor the return status of the function exiting.\n\nTRAPZERR\nExecuted whenever a command has a non-zero exit status.  However, the function is  not\nexecuted if the command occurred in a sublist followed by `&&' or `||'; only the final\ncommand  in a sublist of this type causes the trap to be executed.  The function TRAP‐\nERR acts the same as TRAPZERR on systems where there is no SIGERR (this is  the  usual\ncase).\n\nThe  functions beginning `TRAP' may alternatively be defined with the trap builtin:  this may\nbe preferable for some uses.  Setting a trap with one form removes any trap of the other form\nfor the same signal; removing a trap in either form removes all traps for  the  same  signal.\nThe forms\n\nTRAPNAL() {\n# code\n}\n\n('function traps') and\n\ntrap '\n# code\n' NAL\n\n('list traps') are equivalent in most ways, the exceptions being the following:\n\n•      Function  traps  have all the properties of normal functions, appearing in the list of\nfunctions and being called with their own function context  rather  than  the  context\nwhere the trap was triggered.\n\n•      The  return  status  from function traps is special, whereas a return from a list trap\ncauses the surrounding context to return with the given status.\n\n•      Function traps are not reset within subshells, in accordance with zsh behaviour;  list\ntraps are reset, in accordance with POSIX behaviour.\n"
                }
            ]
        },
        "JOBS": {
            "content": "If  the  MONITOR option is set, an interactive shell associates a job with each pipeline.  It\nkeeps a table of current jobs, printed by the jobs command, and assigns  them  small  integer\nnumbers.   When a job is started asynchronously with `&', the shell prints a line to standard\nerror which looks like:\n\n[1] 1234\n\nindicating that the job which was started  asynchronously  was  job  number  1  and  had  one\n(top-level) process, whose process ID was 1234.\n\nIf a job is started with `&|' or `&!', then that job is immediately disowned.  After startup,\nit does not have a place in the job table, and is not subject to the job control features de‐\nscribed here.\n\nIf  you  are  running  a job and wish to do something else you may hit the key ^Z (control-Z)\nwhich sends a TSTP signal to the current job:  this key may be redefined by the  susp  option\nof  the  external  stty command.  The shell will then normally indicate that the job has been\n`suspended', and print another prompt.  You can  then  manipulate  the  state  of  this  job,\nputting it in the background with the bg command, or run some other commands and then eventu‐\nally  bring  the job back into the foreground with the foreground command fg.  A ^Z takes ef‐\nfect immediately and is like an interrupt in that pending output and unread  input  are  dis‐\ncarded when it is typed.\n\nA job being run in the background will suspend if it tries to read from the terminal.\n\nNote  that  if the job running in the foreground is a shell function, then suspending it will\nhave the effect of causing the shell to fork.  This is necessary to separate  the  function's\nstate from that of the parent shell performing the job control, so that the latter can return\nto the command line prompt.  As a result, even if fg is used to continue the job the function\nwill no longer be part of the parent shell, and any variables set by the function will not be\nvisible  in  the parent shell.  Thus the behaviour is different from the case where the func‐\ntion was never suspended.  Zsh is different from many other shells in this regard.\n\nOne additional side effect is that use of disown with a job created by suspending shell  code\nin  this  fashion  is delayed: the job can only be disowned once any process started from the\nparent shell has terminated.  At that point, the disowned job disappears  silently  from  the\njob list.\n\nThe  same  behaviour  is  found  when the shell is executing code as the right hand side of a\npipeline or any complex shell construct such as if, for, etc., in order that the entire block\nof code can be managed as a single job.  Background jobs are normally allowed to produce out‐\nput, but this can be disabled by giving the command `stty tostop'.  If you set this  tty  op‐\ntion,  then  background  jobs  will suspend when they try to produce output like they do when\nthey try to read input.\n\nWhen a command is suspended and continued later with the fg or wait  builtins,  zsh  restores\ntty  modes that were in effect when it was suspended.  This (intentionally) does not apply if\nthe command is continued via `kill -CONT', nor when it is continued with bg.\n\nThere are several ways to refer to jobs in the shell.  A  job  can  be  referred  to  by  the\nprocess ID of any process of the job or by one of the following:\n\n%number\nThe job with the given number.\n%string\nThe last job whose command line begins with string.\n%?string\nThe last job whose command line contains string.\n%%     Current job.\n%+     Equivalent to `%%'.\n%-     Previous job.\n\nThe shell learns immediately whenever a process changes state.  It normally informs you when‐\never  a job becomes blocked so that no further progress is possible.  If the NOTIFY option is\nnot set, it waits until just before it prints a prompt before it informs you.  All such noti‐\nfications are sent directly to the terminal, not to the standard output or standard error.\n\nWhen the monitor mode is on, each background job that completes triggers  any  trap  set  for\nCHLD.\n\nWhen  you try to leave the shell while jobs are running or suspended, you will be warned that\n`You have suspended (running) jobs'.  You may use the jobs command to see what they are.   If\nyou  do this or immediately try to exit again, the shell will not warn you a second time; the\nsuspended jobs will be terminated, and the running jobs will be sent a SIGHUP signal, if  the\nHUP option is set.\n\nTo  avoid having the shell terminate the running jobs, either use the nohup(1) command or the\ndisown builtin.\n",
            "subsections": []
        },
        "SIGNALS": {
            "content": "The INT and QUIT signals for an invoked command are ignored if the command is followed by `&'\nand the MONITOR option is not active.  The shell itself always ignores the QUIT signal.  Oth‐\nerwise, signals have the values inherited by the shell from its parent (but see  the  TRAPNAL\nspecial functions in the section `Functions').\n\nCertain  jobs  are  run  asynchronously by the shell other than those explicitly put into the\nbackground; even in cases where the shell would usually wait for such jobs, an explicit  exit\ncommand or exit due to the option ERREXIT will cause the shell to exit without waiting.  Ex‐\namples  of such asynchronous jobs are process substitution, see the section PROCESS SUBSTITU‐\nTION in the zshexpn(1) manual page, and the handler processes for multios,  see  the  section\nMULTIOS in the zshmisc(1) manual page.\n",
            "subsections": []
        },
        "ARITHMETIC EVALUATION": {
            "content": "The shell can perform integer and floating point arithmetic, either using the builtin let, or\nvia  a substitution of the form $((...)).  For integers, the shell is usually compiled to use\n8-byte precision where this is available, otherwise  precision  is  4  bytes.   This  can  be\ntested,  for  example,  by giving the command `print - $(( 12345678901 ))'; if the number ap‐\npears unchanged, the precision is at least 8 bytes.  Floating point  arithmetic  always  uses\nthe  `double'  type with whatever corresponding precision is provided by the compiler and the\nlibrary.\n\nThe let builtin command takes arithmetic expressions as arguments; each  is  evaluated  sepa‐\nrately.   Since  many of the arithmetic operators, as well as spaces, require quoting, an al‐\nternative form is provided: for any command which begins with a `((', all the characters  un‐\ntil  a  matching `))' are treated as a double-quoted expression and arithmetic expansion per‐\nformed as for an argument of let.  More precisely, `((...))' is equivalent  to  `let  \"...\"'.\nThe  return  status  is  0  if the arithmetic value of the expression is non-zero, 1 if it is\nzero, and 2 if an error occurred.\n\nFor example, the following statement\n\n(( val = 2 + 1 ))\n\nis equivalent to\n\nlet \"val = 2 + 1\"\n\nboth assigning the value 3 to the shell variable val and returning a zero status.\n\nIntegers can be in bases other than 10.  A leading `0x' or `0X'  denotes  hexadecimal  and  a\nleading `0b' or `0B' binary.  Integers may also be of the form `base#n', where base is a dec‐\nimal  number between two and thirty-six representing the arithmetic base and n is a number in\nthat base (for example, `16#ff' is 255 in hexadecimal).  The base# may also  be  omitted,  in\nwhich case base 10 is used.  For backwards compatibility the form `[base]n' is also accepted.\n\nAn  integer expression or a base given in the form `base#n' may contain underscores (`') af‐\nter the leading digit for visual guidance; these are ignored in  computation.   Examples  are\n1000000 or 0xffffffff which are equivalent to 1000000 and 0xffffffff respectively.\n\nIt  is also possible to specify a base to be used for output in the form `[#base]', for exam‐\nple `[#16]'.  This is used when outputting arithmetical substitutions or  when  assigning  to\nscalar  parameters, but an explicitly defined integer or floating point parameter will not be\naffected.  If an integer variable is implicitly defined by an arithmetic expression, any base\nspecified in this way will be set as the variable's output arithmetic base as if  the  option\n`-i  base'  to the typeset builtin had been used.  The expression has no precedence and if it\noccurs more than once in a mathematical expression, the last encountered is used.  For  clar‐\nity it is recommended that it appear at the beginning of an expression.  As an example:\n\ntypeset -i 16 y\nprint $(( [#8] x = 32, y = 32 ))\nprint $x $y\n\noutputs  first  `8#40',  the rightmost value in the given output base, and then `8#40 16#20',\nbecause y has been explicitly declared to have output base 16, while x (assuming it does  not\nalready exist) is implicitly typed by the arithmetic evaluation, where it acquires the output\nbase 8.\n\nThe base may be replaced or followed by an underscore, which may itself be followed by a pos‐\nitive integer (if it is missing the value 3 is used).  This indicates that underscores should\nbe  inserted  into  the output string, grouping the number for visual clarity.  The following\ninteger specifies the number of digits to group together.  For example:\n\nsetopt cbases\nprint $(( [#164] 65536  2 ))\n\noutputs `0x100000000'.\n\nThe feature can be used with floating point numbers, in which case the base must be  omitted;\ngrouping is away from the decimal point.  For example,\n\nzmodload zsh/mathfunc\nprint $(( [#] sqrt(1e7) ))\n\noutputs `3162.2776601683795' (the number of decimal places shown may vary).\n\nIf  the  CBASES  option is set, hexadecimal numbers are output in the standard C format, for\nexample `0xFF' instead of the usual `16#FF'.  If the option OCTALZEROES is also set  (it  is\nnot by default), octal numbers will be treated similarly and hence appear as `077' instead of\n`8#77'.   This  option has no effect on the output of bases other than hexadecimal and octal,\nand these formats are always understood on input.\n\nWhen an output base is specified using the `[#base]' syntax, an appropriate base prefix  will\nbe output if necessary, so that the value output is valid syntax for input.  If the # is dou‐\nbled, for example `[##16]', then no base prefix is output.\n\nFloating  point  constants  are recognized by the presence of a decimal point or an exponent.\nThe decimal point may be the first character of the constant, but the exponent character e or\nE may not, as it will be taken for a parameter name.  All numeric parts (before and after the\ndecimal point and in the exponent) may contain underscores after the leading digit for visual\nguidance; these are ignored in computation.\n\nAn arithmetic expression uses nearly the same syntax and associativity of expressions  as  in\nC.\n\nIn  the native mode of operation, the following operators are supported (listed in decreasing\norder of precedence):\n",
            "subsections": [
                {
                    "name": "+ - ! ~ ++ --",
                    "content": "unary plus/minus, logical NOT, complement, {pre,post}{in,de}crement\n<< >>  bitwise shift left, right\n&      bitwise AND\n^      bitwise XOR\n|      bitwise OR\nexponentiation\n* / %  multiplication, division, modulus (remainder)\n+ -    addition, subtraction"
                },
                {
                    "name": "< > <= >=",
                    "content": "comparison\n== !=  equality and inequality\n&&     logical AND\n|| ^^  logical OR, XOR\n? :    ternary operator\n= += -= *= /= %= &= ^= |= <<= >>= &&= ||= ^^= =\nassignment\n,      comma operator\n\nThe operators `&&', `||', `&&=', and `||=' are short-circuiting, and only one of  the  latter\ntwo  expressions in a ternary operator is evaluated.  Note the precedence of the bitwise AND,\nOR, and XOR operators.\n\nWith the option CPRECEDENCES the precedences (but no other properties) of the operators  are\naltered to be the same as those in most other languages that support the relevant operators:\n"
                },
                {
                    "name": "+ - ! ~ ++ --",
                    "content": "unary plus/minus, logical NOT, complement, {pre,post}{in,de}crement\nexponentiation\n* / %  multiplication, division, modulus (remainder)\n+ -    addition, subtraction\n<< >>  bitwise shift left, right"
                },
                {
                    "name": "< > <= >=",
                    "content": "comparison\n== !=  equality and inequality\n&      bitwise AND\n^      bitwise XOR\n|      bitwise OR\n&&     logical AND\n^^     logical XOR\n||     logical OR\n? :    ternary operator\n= += -= *= /= %= &= ^= |= <<= >>= &&= ||= ^^= =\nassignment\n,      comma operator\n\nNote  the  precedence of exponentiation in both cases is below that of unary operators, hence\n`-32' evaluates as `9', not `-9'.  Use parentheses where necessary: `-(32)'.  This is for\ncompatibility with other shells.\n\nMathematical functions can be called with the syntax `func(args)', where the function decides\nif the args is used as a string or a comma-separated  list  of  arithmetic  expressions.  The\nshell currently defines no mathematical functions by default, but the module zsh/mathfunc may\nbe  loaded  with  the  zmodload builtin to provide standard floating point mathematical func‐\ntions.\n\nAn expression of the form `##x' where x is any character  sequence  such  as  `a',  `^A',  or\n`\\M-\\C-x'  gives  the value of this character and an expression of the form `#name' gives the\nvalue of the first character of the contents of the parameter name.  Character values are ac‐\ncording to the character set used in the current locale; for multibyte character handling the\noption MULTIBYTE must be set.  Note that this form is different from `$#name', a standard pa‐\nrameter substitution which gives the length of the parameter name.  `#\\' is accepted  instead\nof `##', but its use is deprecated.\n\nNamed  parameters  and  subscripted arrays can be referenced by name within an arithmetic ex‐\npression without using the parameter expansion syntax.  For example,\n\n((val2 = val1 * 2))\n\nassigns twice the value of $val1 to the parameter named val2.\n\nAn internal integer representation of a named parameter can be  specified  with  the  integer\nbuiltin.  Arithmetic evaluation is performed on the value of each assignment to a named para‐\nmeter  declared  integer in this manner.  Assigning a floating point number to an integer re‐\nsults in rounding towards zero.\n\nLikewise, floating point numbers can be declared with the float builtin; there are two types,\ndiffering only in their output format, as described for the typeset builtin.  The output for‐\nmat can be bypassed by using arithmetic substitution instead of the  parameter  substitution,\ni.e.  `${float}' uses the defined format, but `$((float))' uses a generic floating point for‐\nmat.\n\nPromotion of integer to floating point values is performed where necessary.  In addition,  if\nany  operator which requires an integer (`&', `|', `^', `<<', `>>' and their equivalents with\nassignment) is given a floating point argument, it will be silently rounded towards zero  ex‐\ncept for `~' which rounds down.\n\nUsers  should  beware  that, in common with many other programming languages but not software\ndesigned for calculation, the evaluation of an expression in zsh is taken a term  at  a  time\nand promotion of integers to floating point does not occur in terms only containing integers.\nA  typical  result of this is that a division such as 6/8 is truncated, in this being rounded\ntowards 0.  The FORCEFLOAT shell option can be used in scripts or functions  where  floating\npoint evaluation is required throughout.\n\nScalar  variables  can  hold integer or floating point values at different times; there is no\nmemory of the numeric type in this case.\n\nIf a variable is first assigned in a numeric context without previously  being  declared,  it\nwill  be  implicitly  typed as integer or float and retain that type either until the type is\nexplicitly changed or until the end of the scope.  This  can  have  unforeseen  consequences.\nFor example, in the loop\n\nfor (( f = 0; f < 1; f += 0.1 )); do\n# use $f\ndone\n\nif  f  has  not already been declared, the first assignment will cause it to be created as an\ninteger, and consequently the operation `f += 0.1' will always cause the result to  be  trun‐\ncated  to zero, so that the loop will fail.  A simple fix would be to turn the initialization\ninto `f = 0.0'.  It is therefore best to declare numeric variables with explicit types.\n"
                }
            ]
        },
        "CONDITIONAL EXPRESSIONS": {
            "content": "A conditional expression is used with the [[ compound command to test attributes of files and\nto compare strings.  Each expression can be constructed from one or  more  of  the  following\nunary or binary expressions:\n",
            "subsections": [
                {
                    "name": "-a",
                    "content": "true if file exists.\n",
                    "flag": "-a"
                },
                {
                    "name": "-b",
                    "content": "true if file exists and is a block special file.\n",
                    "flag": "-b"
                },
                {
                    "name": "-c",
                    "content": "true if file exists and is a character special file.\n",
                    "flag": "-c"
                },
                {
                    "name": "-d",
                    "content": "true if file exists and is a directory.\n",
                    "flag": "-d"
                },
                {
                    "name": "-e",
                    "content": "true if file exists.\n",
                    "flag": "-e"
                },
                {
                    "name": "-f",
                    "content": "true if file exists and is a regular file.\n",
                    "flag": "-f"
                },
                {
                    "name": "-g",
                    "content": "true if file exists and has its setgid bit set.\n",
                    "flag": "-g"
                },
                {
                    "name": "-h",
                    "content": "true if file exists and is a symbolic link.\n",
                    "flag": "-h"
                },
                {
                    "name": "-k",
                    "content": "true if file exists and has its sticky bit set.\n",
                    "flag": "-k"
                },
                {
                    "name": "-n",
                    "content": "true if length of string is non-zero.\n",
                    "flag": "-n"
                },
                {
                    "name": "-o",
                    "content": "true if option named option is on.  option may be a single character, in which case it\nis a single letter option name.  (See the section `Specifying Options'.)\n\nWhen no option named option exists, and the POSIXBUILTINS option hasn't been set, re‐\nturn 3 with a warning.  If that option is set, return 1 with no warning.\n",
                    "flag": "-o"
                },
                {
                    "name": "-p",
                    "content": "true if file exists and is a FIFO special file (named pipe).\n",
                    "flag": "-p"
                },
                {
                    "name": "-r",
                    "content": "true if file exists and is readable by current process.\n",
                    "flag": "-r"
                },
                {
                    "name": "-s",
                    "content": "true if file exists and has size greater than zero.\n",
                    "flag": "-s"
                },
                {
                    "name": "-t",
                    "content": "(note: fd is not optional)\n",
                    "flag": "-t"
                },
                {
                    "name": "-u",
                    "content": "true if file exists and has its setuid bit set.\n",
                    "flag": "-u"
                },
                {
                    "name": "-v",
                    "content": "true if shell variable varname is set.\n",
                    "flag": "-v"
                },
                {
                    "name": "-w",
                    "content": "true if file exists and is writable by current process.\n",
                    "flag": "-w"
                },
                {
                    "name": "-x",
                    "content": "true if file exists and is executable by current process.  If file exists and is a di‐\nrectory, then the current process has permission to search in the directory.\n",
                    "flag": "-x"
                },
                {
                    "name": "-z",
                    "content": "true if length of string is zero.\n",
                    "flag": "-z"
                },
                {
                    "name": "-L",
                    "content": "true if file exists and is a symbolic link.\n",
                    "flag": "-L"
                },
                {
                    "name": "-O",
                    "content": "true if file exists and is owned by the effective user ID of this process.\n",
                    "flag": "-O"
                },
                {
                    "name": "-G",
                    "content": "true if file exists and its group matches the effective group ID of this process.\n",
                    "flag": "-G"
                },
                {
                    "name": "-S",
                    "content": "true if file exists and is a socket.\n",
                    "flag": "-S"
                },
                {
                    "name": "-N",
                    "content": "true if file exists and its access time is not newer than its modification time.\n\nfile1 -nt file2\ntrue if file1 exists and is newer than file2.\n\nfile1 -ot file2\ntrue if file1 exists and is older than file2.\n\nfile1 -ef file2\ntrue if file1 and file2 exist and refer to the same file.\n\nstring = pattern\nstring == pattern\ntrue if string matches pattern.  The two forms are exactly equivalent.  The  `='  form\nis  the  traditional shell syntax (and hence the only one generally used with the test\nand [ builtins); the `==' form provides compatibility with  other  sorts  of  computer\nlanguage.\n\nstring != pattern\ntrue if string does not match pattern.\n\nstring =~ regexp\ntrue  if string matches the regular expression regexp.  If the option REMATCHPCRE is\nset regexp is tested as a PCRE regular expression using the zsh/pcre module,  else  it\nis  tested  as  a  POSIX extended regular expression using the zsh/regex module.  Upon\nsuccessful match, some variables will be updated; no  variables  are  changed  if  the\nmatching fails.\n\nIf  the  option  BASHREMATCH is not set the scalar parameter MATCH is set to the sub‐\nstring that matched the pattern and the integer parameters MBEGIN and MEND to the  in‐\ndex of the start and end, respectively, of the match in string, such that if string is\ncontained  in  variable  var  the  expression  `${var[$MBEGIN,$MEND]}' is identical to\n`$MATCH'.  The setting of the option KSHARRAYS is  respected.   Likewise,  the  array\nmatch  is  set to the substrings that matched parenthesised subexpressions and the ar‐\nrays mbegin and mend to the indices of the start and end positions,  respectively,  of\nthe  substrings  within string.  The arrays are not set if there were no parenthesised\nsubexpressions.  For example, if the string `a short string' is  matched  against  the\nregular  expression `s(...)t', then (assuming the option KSHARRAYS is not set) MATCH,\nMBEGIN and MEND are `short', 3 and 7, respectively, while match, mbegin and  mend  are\nsingle entry arrays containing the strings `hor', `4' and `6', respectively.\n\nIf  the option BASHREMATCH is set the array BASHREMATCH is set to the substring that\nmatched the pattern followed by the substrings that matched  parenthesised  subexpres‐\nsions within the pattern.\n\nstring1 < string2\ntrue if string1 comes before string2 based on ASCII value of their characters.\n\nstring1 > string2\ntrue if string1 comes after string2 based on ASCII value of their characters.\n\nexp1 -eq exp2\ntrue  if  exp1 is numerically equal to exp2.  Note that for purely numeric comparisons\nuse of the ((...)) builtin described in the section `ARITHMETIC  EVALUATION'  is  more\nconvenient than conditional expressions.\n\nexp1 -ne exp2\ntrue if exp1 is numerically not equal to exp2.\n\nexp1 -lt exp2\ntrue if exp1 is numerically less than exp2.\n\nexp1 -gt exp2\ntrue if exp1 is numerically greater than exp2.\n\nexp1 -le exp2\ntrue if exp1 is numerically less than or equal to exp2.\n\nexp1 -ge exp2\ntrue if exp1 is numerically greater than or equal to exp2.\n\n( exp )\ntrue if exp is true.\n\n! exp  true if exp is false.\n\nexp1 && exp2\ntrue if exp1 and exp2 are both true.\n\nexp1 || exp2\ntrue if either exp1 or exp2 is true.\n\nFor compatibility, if there is a single argument that is not syntactically significant, typi‐\ncally  a variable, the condition is treated as a test for whether the expression expands as a\nstring of non-zero length.  In other words, [[ $var ]] is the same as [[ -n $var ]].   It  is\nrecommended that the second, explicit, form be used where possible.\n\nNormal shell expansion is performed on the file, string and pattern arguments, but the result\nof each expansion is constrained to be a single word, similar to the effect of double quotes.\n\nFilename  generation is not performed on any form of argument to conditions.  However, it can\nbe forced in any case where normal shell expansion is valid and when the option EXTENDEDGLOB\nis in effect by using an explicit glob qualifier of the form (#q) at the end of  the  string.\nA normal glob qualifier expression may appear between the `q' and the closing parenthesis; if\nnone appears the expression has no effect beyond causing filename generation.  The results of\nfilename  generation  are joined together to form a single word, as with the results of other\nforms of expansion.\n\nThis special use of filename generation is only available with the [[ syntax.  If the  condi‐\ntion  occurs  within  the  [ or test builtin commands then globbing occurs instead as part of\nnormal command line expansion before the condition is evaluated.  In this case it may  gener‐\nate multiple words which are likely to confuse the syntax of the test command.\n\nFor example,\n\n[[ -n file*(#qN) ]]\n\nproduces  status  zero if and only if there is at least one file in the current directory be‐\nginning with the string `file'.  The globbing qualifier N  ensures  that  the  expression  is\nempty if there is no matching file.\n\nPattern  metacharacters  are  active  for the pattern arguments; the patterns are the same as\nthose used for filename generation, see zshexpn(1), but there is no special behaviour of  `/'\nnor initial dots, and no glob qualifiers are allowed.\n\nIn  each of the above expressions, if file is of the form `/dev/fd/n', where n is an integer,\nthen the test applied to the open file whose descriptor number is n, even if  the  underlying\nsystem does not support the /dev/fd directory.\n\nIn the forms which do numeric comparison, the expressions exp undergo arithmetic expansion as\nif they were enclosed in $((...)).\n\nFor example, the following:\n\n[[ ( -f foo || -f bar ) && $report = y* ]] && print File exists.\n\ntests  if either file foo or file bar exists, and if so, if the value of the parameter report\nbegins with `y'; if the complete condition is true, the message `File exists.' is printed.\n",
                    "flag": "-N"
                }
            ]
        },
        "EXPANSION OF PROMPT SEQUENCES": {
            "content": "Prompt sequences undergo a special form of expansion.  This type of expansion is also  avail‐\nable using the -P option to the print builtin.\n\nIf  the  PROMPTSUBST option is set, the prompt string is first subjected to parameter expan‐\nsion, command substitution and arithmetic expansion.  See zshexpn(1).\n\nCertain escape sequences may be recognised in the prompt string.\n\nIf the PROMPTBANG option is set, a `!' in the prompt is  replaced  by  the  current  history\nevent number.  A literal `!' may then be represented as `!!'.\n\nIf  the  PROMPTPERCENT  option  is set, certain escape sequences that start with `%' are ex‐\npanded.  Many escapes are followed by a single character, although some of these take an  op‐\ntional  integer argument that should appear between the `%' and the next character of the se‐\nquence.  More complicated escape sequences are available to provide conditional expansion.\n",
            "subsections": []
        },
        "SIMPLE PROMPT ESCAPES": {
            "content": "",
            "subsections": [
                {
                    "name": "Special characters",
                    "content": "%%     A `%'.\n\n%)     A `)'.\n"
                },
                {
                    "name": "Login information",
                    "content": "%l     The line (tty) the user is logged in on, without `/dev/' prefix.  If the  name  starts\nwith `/dev/tty', that prefix is stripped.\n\n%M     The full machine hostname.\n\n%m     The  hostname  up to the first `.'.  An integer may follow the `%' to specify how many\ncomponents of the hostname are desired.  With a negative integer, trailing  components\nof the hostname are shown.\n\n%n     $USERNAME.\n\n%y     The  line (tty) the user is logged in on, without `/dev/' prefix.  This does not treat\n`/dev/tty' names specially.\n"
                },
                {
                    "name": "Shell state",
                    "content": "%#     A `#' if the  shell  is  running  with  privileges,  a  `%'  if  not.   Equivalent  to\n`%(!.#.%%)'.   The  definition of `privileged', for these purposes, is that either the\neffective user ID is zero, or, if POSIX.1e capabilities are supported, that  at  least\none capability is raised in either the Effective or Inheritable capability vectors.\n\n%?     The return status of the last command executed just before the prompt.\n\n%     The  status  of  the parser, i.e. the shell constructs (like `if' and `for') that have\nbeen started on the command line. If given an integer number that many strings will be\nprinted; zero or negative or no integer means print as many as  there  are.   This  is\nmost  useful  in  prompts  PS2  for  continuation lines and PS4 for debugging with the\nXTRACE option; in the latter case it will also work non-interactively.\n\n%^     The status of the parser in reverse. This is the same as `%' other than the order  of\nstrings.  It is often used in RPS2.\n\n%d\n%/     Current  working  directory.   If an integer follows the `%', it specifies a number of\ntrailing components of the current working directory to show;  zero  means  the  whole\npath.   A negative integer specifies leading components, i.e. %-1d specifies the first\ncomponent.\n\n%~     As %d and %/, but if the current working directory starts with $HOME, that part is re‐\nplaced by a `~'. Furthermore, if it has a named directory as its prefix, that part  is\nreplaced  by  a  `~'  followed by the name of the directory, but only if the result is\nshorter than the full path; see Dynamic and Static named directories in zshexpn(1).\n\n%e     Evaluation depth of the current sourced file, shell function, or eval.  This is incre‐\nmented or decremented every time the value of %N is set  or  reverted  to  a  previous\nvalue, respectively.  This is most useful for debugging as part of $PS4.\n\n%h\n%!     Current history event number.\n\n%i     The  line  number currently being executed in the script, sourced file, or shell func‐\ntion given by %N.  This is most useful for debugging as part of $PS4.\n\n%I     The line number currently being executed in the file %x.  This is similar to  %i,  but\nthe  line  number is always a line number in the file where the code was defined, even\nif the code is a shell function.\n\n%j     The number of jobs.\n\n%L     The current value of $SHLVL.\n\n%N     The name of the script, sourced file, or shell function that zsh is currently  execut‐\ning, whichever was started most recently.  If there is none, this is equivalent to the\nparameter $0.  An integer may follow the `%' to specify a number of trailing path com‐\nponents  to show; zero means the full path.  A negative integer specifies leading com‐\nponents.\n\n%x     The name of the file containing the source code currently being  executed.   This  be‐\nhaves  as  %N  except  that function and eval command names are not shown, instead the\nfile where they were defined.\n\n%c\n%.\n%C     Trailing component of the current working directory.  An integer may follow the `%' to\nget more than one component.  Unless `%C' is  used,  tilde  contraction  is  performed\nfirst.  These are deprecated as %c and %C are equivalent to %1~ and %1/, respectively,\nwhile explicit positive integers have the same effect as for the latter two sequences.\n"
                },
                {
                    "name": "Date and time",
                    "content": "%D     The date in yy-mm-dd format.\n\n%T     Current time of day, in 24-hour format.\n\n%t\n%@     Current time of day, in 12-hour, am/pm format.\n\n%*     Current time of day in 24-hour format, with seconds.\n\n%w     The date in day-dd format.\n\n%W     The date in mm/dd/yy format.\n\n%D{string}\nstring  is  formatted  using the strftime function.  See strftime(3) for more details.\nVarious zsh extensions provide numbers with no leading zero or space if the number  is\na single digit:\n\n%f     a day of the month\n%K     the hour of the day on the 24-hour clock\n%L     the hour of the day on the 12-hour clock\n\nIn  addition,  if  the system supports the POSIX gettimeofday system call, %. provides\ndecimal fractions of a second since the epoch with leading zeroes.  By  default  three\ndecimal places are provided, but a number of digits up to 9 may be given following the\n%; hence %6.  outputs microseconds, and %9. outputs nanoseconds.  (The latter requires\na  nanosecond-precision clockgettime; systems lacking this will return a value multi‐\nplied by the appropriate power of 10.)  A  typical  example  of  this  is  the  format\n`%D{%H:%M:%S.%.}'.\n\nThe GNU extension %N is handled as a synonym for %9..\n\nAdditionally,  the  GNU  extension  that  a `-' between the % and the format character\ncauses a leading zero or space to be stripped is handled directly by the shell for the\nformat characters d, f, H, k, l, m, M, S and y; any other format characters  are  pro‐\nvided  to  the  system's  strftime(3) with any leading `-' present, so the handling is\nsystem dependent.  Further GNU (or other) extensions are also  passed  to  strftime(3)\nand may work if the system supports them.\n"
                },
                {
                    "name": "Visual effects",
                    "content": "%B (%b)\nStart (stop) boldface mode.\n\n%E     Clear to end of line.\n\n%U (%u)\nStart (stop) underline mode.\n\n%S (%s)\nStart (stop) standout mode.\n\n%F (%f)\nStart  (stop)  using a different foreground colour, if supported by the terminal.  The\ncolour may be specified two ways: either as a numeric argument, as normal, or by a se‐\nquence in braces following the %F, for example %F{red}.  In the latter case the values\nallowed are as described for the fg zlehighlight attribute; see Character  Highlight‐\ning  in  zshzle(1).   This means that numeric colours are allowed in the second format\nalso.\n\n%K (%k)\nStart (stop) using a different bacKground colour.  The syntax is identical to that for\n%F and %f.\n\n%{...%}\nInclude a string as a literal escape sequence.  The string within  the  braces  should\nnot change the cursor position.  Brace pairs can nest.\n\nA positive numeric argument between the % and the { is treated as described for %G be‐\nlow.\n\n%G     Within a %{...%} sequence, include a `glitch': that is, assume that a single character\nwidth will be output.  This is useful when outputting characters that otherwise cannot\nbe  correctly handled by the shell, such as the alternate character set on some termi‐\nnals.  The characters in question can be included within a %{...%}  sequence  together\nwith the appropriate number of %G sequences to indicate the correct width.  An integer\nbetween  the `%' and `G' indicates a character width other than one.  Hence %{seq%2G%}\noutputs seq and assumes it takes up the width of two standard characters.\n\nMultiple uses of %G accumulate in the obvious fashion; the position of the %G is unim‐\nportant.  Negative integers are not handled.\n\nNote that when prompt truncation is in use it is advisable to divide  up  output  into\nsingle  characters  within each %{...%} group so that the correct truncation point can\nbe found.\n"
                }
            ]
        },
        "CONDITIONAL SUBSTRINGS IN PROMPTS": {
            "content": "%v     The value of the first element of the psvar array parameter.  Following the  `%'  with\nan  integer  gives that element of the array.  Negative integers count from the end of\nthe array.\n\n%(x.true-text.false-text)\nSpecifies a ternary expression.  The character following the x is arbitrary; the  same\ncharacter is used to separate the text for the `true' result from that for the `false'\nresult.   This separator may not appear in the true-text, except as part of a %-escape\nsequence.  A `)' may appear in the false-text as `%)'.  true-text and  false-text  may\nboth  contain  arbitrarily-nested  escape sequences, including further ternary expres‐\nsions.\n\nThe left parenthesis may be preceded or followed by a positive integer  n,  which  de‐\nfaults  to  zero.   A negative integer will be multiplied by -1, except as noted below\nfor `l'.  The test character x may be any of the following:\n\n!      True if the shell is running with privileges.\n#      True if the effective uid of the current process is n.\n?      True if the exit status of the last command was n.\nTrue if at least n shell constructs were started.\nC\n/      True if the current absolute path has at least n elements relative to the  root\ndirectory, hence / is counted as 0 elements.\nc\n.\n~      True if the current path, with prefix replacement, has at least n elements rel‐\native to the root directory, hence / is counted as 0 elements.\nD      True if the month is equal to n (January = 0).\nd      True if the day of the month is equal to n.\ne      True if the evaluation depth is at least n.\ng      True if the effective gid of the current process is n.\nj      True if the number of jobs is at least n.\nL      True if the SHLVL parameter is at least n.\nl      True  if  at  least n characters have already been printed on the current line.\nWhen n is negative, true if at least abs(n) characters remain before the  oppo‐\nsite margin (thus the left margin for RPROMPT).\nS      True if the SECONDS parameter is at least n.\nT      True if the time in hours is equal to n.\nt      True if the time in minutes is equal to n.\nv      True if the array psvar has at least n elements.\nV      True if element n of the array psvar is set and non-empty.\nw      True if the day of the week is equal to n (Sunday = 0).\n\n%<string<\n%>string>\n%[xstring]\nSpecifies  truncation  behaviour  for  the remainder of the prompt string.  The third,\ndeprecated, form is equivalent to `%xstringx', i.e. x may be `<' or `>'.   The  string\nwill  be displayed in place of the truncated portion of any string; note this does not\nundergo prompt expansion.\n\nThe numeric argument, which in the third form may appear immediately  after  the  `[',\nspecifies the maximum permitted length of the various strings that can be displayed in\nthe  prompt.   In the first two forms, this numeric argument may be negative, in which\ncase the truncation length is determined by subtracting the absolute value of the  nu‐\nmeric  argument from the number of character positions remaining on the current prompt\nline.  If this results in a zero or negative length, a length of 1 is used.  In  other\nwords, a negative argument arranges that after truncation at least n characters remain\nbefore the right margin (left margin for RPROMPT).\n\nThe forms with `<' truncate at the left of the string, and the forms with `>' truncate\nat  the  right  of the string.  For example, if the current directory is `/home/pike',\nthe prompt `%8<..<%/' will expand to `..e/pike'.   In  this  string,  the  terminating\ncharacter  (`<',  `>'  or `]'), or in fact any character, may be quoted by a preceding\n`\\'; note when using print -P, however, that this must be doubled  as  the  string  is\nalso subject to standard print processing, in addition to any backslashes removed by a\ndouble quoted string:  the worst case is therefore `print -P \"%<\\\\\\\\<<...\"'.\n\nIf  the string is longer than the specified truncation length, it will appear in full,\ncompletely replacing the truncated string.\n\nThe part of the prompt string to be truncated runs to the end of the string, or to the\nend of the next enclosing group of the `%(' construct, or to the next  truncation  en‐\ncountered  at  the  same grouping level (i.e. truncations inside a `%(' are separate),\nwhich ever comes first.  In particular, a truncation with argument zero (e.g.,  `%<<')\nmarks  the end of the range of the string to be truncated while turning off truncation\nfrom there on. For example, the prompt `%10<...<%~%<<%# ' will print a truncated  rep‐\nresentation  of  the current directory, followed by a `%' or `#', followed by a space.\nWithout the `%<<', those two characters would be included in the string  to  be  trun‐\ncated.   Note that `%-0<<' is not equivalent to `%<<' but specifies that the prompt is\ntruncated at the right margin.\n\nTruncation applies only within each individual line of the prompt, as delimited by em‐\nbedded newlines (if any).  If the total length of any line of the prompt after trunca‐\ntion is greater than the terminal width, or if the part to be truncated  contains  em‐\nbedded  newlines,  truncation behavior is undefined and may change in a future version\nof the shell.  Use `%-n(l.true-text.false-text)' to remove parts of  the  prompt  when\nthe available space is less than n.\n\nzsh 5.9                                     May 14, 2022                                  ZSHMISC(1)",
            "subsections": []
        }
    },
    "summary": "zshmisc - everything and then some SIMPLE COMMANDS & PIPELINES A  simple command is a sequence of optional parameter assignments followed by blank-separated words, with optional redirections interspersed.  For a description of assignment, see the be‐ ginning of zshparam(1). The first word is the command to be executed, and the remaining words, if any, are  arguments to the command.  If a command name is given, the parameter assignments modify the environment of the command when it is executed.  The value of a simple command is its exit status, or 128 plus the signal number if terminated by a signal.  For example, echo foo is a simple command with arguments. A  pipeline  is  either  a simple command, or a sequence of two or more simple commands where each command is separated from the next by `|' or `|&'.  Where commands are separated by `|', the standard output of the first command is connected to the  standard  input  of  the  next. `|&'  is shorthand for `2>&1 |', which connects both the standard output and the standard er‐ ror of the command to the standard input of the next.  The value of a pipeline is  the  value of  the  last  command, unless the pipeline is preceded by `!' in which case the value is the logical inverse of the value of the last command.  For example, echo foo | sed 's/foo/bar/' is a pipeline, where the output (`foo' plus a newline) of the first command will be passed to the input of the second. If a pipeline is preceded by `coproc', it is executed as a coprocess; a two-way pipe  is  es‐ tablished between it and the parent shell.  The shell can read from or write to the coprocess by  means  of  the `>&p' and `<&p' redirection operators or with `print -p' and `read -p'.  A pipeline cannot be preceded by both `coproc' and `!'.  If job  control  is  active,  the  co‐ process can be treated in other than input and output as an ordinary background job. A  sublist  is  either a single pipeline, or a sequence of two or more pipelines separated by `&&' or `||'.  If two pipelines are separated by `&&', the second pipeline is  executed  only if  the  first succeeds (returns a zero status).  If two pipelines are separated by `||', the second is executed only if the first fails (returns a nonzero status).  Both  operators  have equal precedence and are left associative.  The value of the sublist is the value of the last pipeline executed.  For example, dmesg | grep panic && print yes is a sublist consisting of two pipelines, the second just a simple command which will be exe‐ cuted  if  and  only if the grep command returns a zero status.  If it does not, the value of the sublist is that return status, else it is the status returned by the print  (almost  cer‐ tainly zero). A  list  is  a sequence of zero or more sublists, in which each sublist is terminated by `;', `&', `&|', `&!', or a newline.  This terminator may optionally be omitted from the last  sub‐ list  in the list when the list appears as a complex command inside `(...)' or `{...}'.  When a sublist is terminated by `;' or newline, the shell waits for it to finish before  executing the next sublist.  If a sublist is terminated by a `&', `&|', or `&!', the shell executes the last  pipeline  in it in the background, and does not wait for it to finish (note the differ‐ ence from other shells which execute the whole sublist in the  background).   A  backgrounded pipeline returns a status of zero. More  generally,  a list can be seen as a set of any shell commands whatsoever, including the complex commands below; this is implied wherever the word `list' appears  in  later  descrip‐ tions.  For example, the commands in a shell function form a special sort of list.",
    "flags": [],
    "examples": [],
    "see_also": []
}