1ZSHPARAM(1)                 General Commands Manual                ZSHPARAM(1)
2
3
4

NAME

6       zshparam - zsh parameters
7

DESCRIPTION

9       A  parameter  has  a name, a value, and a number of attributes.  A name
10       may be any sequence of alphanumeric characters and underscores, or  the
11       single  characters  `*',  `@', `#', `?', `-', `$', or `!'.  A parameter
12       whose name begins with an alphanumeric or underscore is  also  referred
13       to as a variable.
14
15       The  attributes  of  a parameter determine the type of its value, often
16       referred to as the parameter type or variable type,  and  also  control
17       other  processing  that  may  be applied to the value when it is refer‐
18       enced.  The value type may be a scalar (a  string,  an  integer,  or  a
19       floating  point number), an array (indexed numerically), or an associa‐
20       tive array (an unordered set of name-value pairs, indexed by name, also
21       referred to as a hash).
22
23       Named  scalar  parameters may have the exported, -x, attribute, to copy
24       them into the process environment, which is then passed from the  shell
25       to  any  new  processes that it starts.  Exported parameters are called
26       environment variables. The shell also imports environment variables  at
27       startup  time  and  automatically marks the corresponding parameters as
28       exported.  Some environment variables are not imported for  reasons  of
29       security  or because they would interfere with the correct operation of
30       other shell features.
31
32       Parameters may also be special, that  is,  they  have  a  predetermined
33       meaning  to  the  shell.   Special  parameters  cannot  have their type
34       changed or their readonly attribute turned off, and if a special param‐
35       eter is unset, then later recreated, the special properties will be re‐
36       tained.
37
38       To declare the type of a parameter, or to assign a  string  or  numeric
39       value to a scalar parameter, use the typeset builtin.
40
41       The value of a scalar parameter may also be assigned by writing:
42
43              name=value
44
45       In  scalar  assignment,  value is expanded as a single string, in which
46       the elements of arrays are joined together; filename expansion  is  not
47       performed unless the option GLOB_ASSIGN is set.
48
49       When  the  integer  attribute, -i, or a floating point attribute, -E or
50       -F, is set for name, the value is  subject  to  arithmetic  evaluation.
51       Furthermore, by replacing `=' with `+=', a parameter can be incremented
52       or appended to.  See the  section  `Array  Parameters'  and  Arithmetic
53       Evaluation (in zshmisc(1)) for additional forms of assignment.
54
55       Note  that assignment may implicitly change the attributes of a parame‐
56       ter.  For example, assigning a number to a variable in arithmetic eval‐
57       uation  may  change  its type to integer or float, and with GLOB_ASSIGN
58       assigning a pattern to a variable may change its type to an array.
59
60       To reference the value of a parameter, write `$name' or `${name}'.  See
61       Parameter  Expansion  in zshexpn(1) for complete details.  That section
62       also explains the effect of the difference between scalar and array as‐
63       signment on parameter expansion.
64

ARRAY PARAMETERS

66       To assign an array value, write one of:
67
68              set -A name value ...
69              name=(value ...)
70              name=([key]=value ...)
71
72       If  no  parameter  name exists, an ordinary array parameter is created.
73       If the parameter name exists and is a scalar, it is replaced by  a  new
74       array.
75
76       In  the  third  form,  key  is  an expression that will be evaluated in
77       arithmetic context (in its simplest form, an integer)  that  gives  the
78       index  of the element to be assigned with value.  In this form any ele‐
79       ments not explicitly mentioned that come before the  largest  index  to
80       which  a  value  is assigned are assigned an empty string.  The indices
81       may be in any order.  Note that this syntax is strict: [  and  ]=  must
82       not  be  quoted, and key may not consist of the unquoted string ]=, but
83       is otherwise treated as a simple string.  The enhanced  forms  of  sub‐
84       script  expression  that may be used when directly subscripting a vari‐
85       able name, described in the section `Array Subscripts' below,  are  not
86       available.
87
88       The  syntaxes  with  and without the explicit key may be mixed.  An im‐
89       plicit key is deduced by incrementing the index from the previously as‐
90       signed  element.  Note that it is not treated as an error if latter as‐
91       signments in this form overwrite earlier assignments.
92
93       For example, assuming the option KSH_ARRAYS is not set, the following:
94
95              array=(one [3]=three four)
96
97       causes the array variable array to contain four elements one, an  empty
98       string, three and four, in that order.
99
100       In the forms where only value is specified, full command line expansion
101       is performed.
102
103       In the [key]=value form, both key and value undergo all forms of expan‐
104       sion  allowed  for  single word shell expansions (this does not include
105       filename generation); these are as performed by the parameter expansion
106       flag  (e)  as described in zshexpn(1).  Nested parentheses may surround
107       value and are included as part of the value, which  is  joined  into  a
108       plain  string; this differs from ksh which allows the values themselves
109       to be arrays.  A future version of zsh may support that.  To cause  the
110       brackets  to  be  interpreted as a character class for filename genera‐
111       tion, and therefore to treat the resulting list of files as  a  set  of
112       values, quote the equal sign using any form of quoting.  Example:
113
114              name=([a-z]'='*)
115
116       To  append to an array without changing the existing values, use one of
117       the following:
118
119              name+=(value ...)
120              name+=([key]=value ...)
121
122       In the second form key may specify an existing index as well as an  in‐
123       dex  off the end of the old array; any existing value is overwritten by
124       value.  Also, it is possible to use [key]+=value to append to  the  ex‐
125       isting value at that index.
126
127       Within the parentheses on the right hand side of either form of the as‐
128       signment, newlines and semicolons are treated the same as white  space,
129       separating individual values.  Any consecutive sequence of such charac‐
130       ters has the same effect.
131
132       Ordinary array parameters may also be explicitly declared with:
133
134              typeset -a name
135
136       Associative arrays must be declared before assignment, by using:
137
138              typeset -A name
139
140       When name refers to an associative array, the list in an assignment  is
141       interpreted as alternating keys and values:
142
143              set -A name key value ...
144              name=(key value ...)
145              name=([key]=value ...)
146
147       Note  that  only one of the two syntaxes above may be used in any given
148       assignment; the forms may not be mixed.  This is unlike the case of nu‐
149       merically indexed arrays.
150
151       Every  key  must  have a value in this case.  Note that this assigns to
152       the entire array, deleting any elements that do not appear in the list.
153       The append syntax may also be used with an associative array:
154
155              name+=(key value ...)
156              name+=([key]=value ...)
157
158       This  adds  a new key/value pair if the key is not already present, and
159       replaces the value for the existing key if it is.  In the  second  form
160       it is also possible to use [key]+=value to append to the existing value
161       at that key.  Expansion is performed identically to  the  corresponding
162       forms for normal arrays, as described above.
163
164       To create an empty array (including associative arrays), use one of:
165
166              set -A name
167              name=()
168
169   Array Subscripts
170       Individual  elements  of an array may be selected using a subscript.  A
171       subscript of the form `[exp]' selects the single element exp, where exp
172       is  an arithmetic expression which will be subject to arithmetic expan‐
173       sion as if it were surrounded by `$((...))'.  The elements are numbered
174       beginning  with  1,  unless  the KSH_ARRAYS option is set in which case
175       they are numbered from zero.
176
177       Subscripts may be used inside braces used to delimit a parameter  name,
178       thus  `${foo[2]}' is equivalent to `$foo[2]'.  If the KSH_ARRAYS option
179       is set, the braced form is the only one that works,  as  bracketed  ex‐
180       pressions otherwise are not treated as subscripts.
181
182       If the KSH_ARRAYS option is not set, then by default accesses to an ar‐
183       ray element with a subscript that evaluates to  zero  return  an  empty
184       string,  while an attempt to write such an element is treated as an er‐
185       ror.  For backward compatibility the KSH_ZERO_SUBSCRIPT option  can  be
186       set  to  cause  subscript  values 0 and 1 to be equivalent; see the de‐
187       scription of the option in zshoptions(1).
188
189       The same subscripting syntax is used  for  associative  arrays,  except
190       that  no  arithmetic expansion is applied to exp.  However, the parsing
191       rules for arithmetic expressions still apply,  which  affects  the  way
192       that  certain special characters must be protected from interpretation.
193       See Subscript Parsing below for details.
194
195       A subscript of the form `[*]' or `[@]' evaluates to all elements of  an
196       array;  there  is no difference between the two except when they appear
197       within double  quotes.   `"$foo[*]"'  evaluates  to  `"$foo[1]  $foo[2]
198       ..."', whereas `"$foo[@]"' evaluates to `"$foo[1]" "$foo[2]" ...'.  For
199       associative arrays, `[*]' or `[@]' evaluate to all the  values,  in  no
200       particular order.  Note that this does not substitute the keys; see the
201       documentation for the `k' flag under Parameter Expansion Flags in  zsh‐
202       expn(1) for complete details.  When an array parameter is referenced as
203       `$name' (with no subscript) it  evaluates  to  `$name[*]',  unless  the
204       KSH_ARRAYS  option  is  set  in which case it evaluates to `${name[0]}'
205       (for an associative array, this means the value of the key  `0',  which
206       may not exist even if there are values for other keys).
207
208       A subscript of the form `[exp1,exp2]' selects all elements in the range
209       exp1 to exp2, inclusive. (Associative arrays are unordered, and  so  do
210       not  support  ranges.) If one of the subscripts evaluates to a negative
211       number, say -n, then the nth element from the end of the array is used.
212       Thus `$foo[-3]' is the third element from the end of the array foo, and
213       `$foo[1,-1]' is the same as `$foo[*]'.
214
215       Subscripting may also be performed on non-array values, in  which  case
216       the  subscripts  specify  a substring to be extracted.  For example, if
217       FOO is set to `foobar', then `echo $FOO[2,5]' prints `ooba'.  Note that
218       some  forms  of  subscripting described below perform pattern matching,
219       and in that case the substring extends from the start of the  match  of
220       the  first  subscript  to the end of the match of the second subscript.
221       For example,
222
223              string="abcdefghijklm"
224              print ${string[(r)d?,(r)h?]}
225
226       prints `defghi'.  This is an obvious generalisation  of  the  rule  for
227       single-character  matches.  For a single subscript, only a single char‐
228       acter is referenced (not the range of characters covered by the match).
229
230       Note that in substring operations the second subscript is handled  dif‐
231       ferently  by the r and R subscript flags: the former takes the shortest
232       match as the length and the latter the longest  match.   Hence  in  the
233       former  case  a  *  at the end is redundant while in the latter case it
234       matches the whole remainder of the string.  This does  not  affect  the
235       result  of the single subscript case as here the length of the match is
236       irrelevant.
237
238   Array Element Assignment
239       A subscript may be used on the left side of an assignment like so:
240
241              name[exp]=value
242
243       In this form of assignment the element or range specified by exp is re‐
244       placed by the expression on the right side.  An array (but not an asso‐
245       ciative array) may be created by assignment to a range or element.  Ar‐
246       rays do not nest, so assigning a parenthesized list of values to an el‐
247       ement or range changes the number of elements in  the  array,  shifting
248       the  other  elements  to accommodate the new values.  (This is not sup‐
249       ported for associative arrays.)
250
251       This syntax also works as an argument to the typeset command:
252
253              typeset "name[exp]"=value
254
255       The value may not be a parenthesized list in this case; only single-el‐
256       ement  assignments may be made with typeset.  Note that quotes are nec‐
257       essary in this case to prevent the brackets from being  interpreted  as
258       filename generation operators.  The noglob precommand modifier could be
259       used instead.
260
261       To delete an element of an ordinary array, assign `()' to that element.
262       To delete an element of an associative array, use the unset command:
263
264              unset "name[exp]"
265
266   Subscript Flags
267       If  the  opening bracket, or the comma in a range, in any subscript ex‐
268       pression is directly followed by an opening parenthesis, the string  up
269       to  the matching closing one is considered to be a list of flags, as in
270       `name[(flags)exp]'.
271
272       The flags s, n and b take an argument; the delimiter is shown below  as
273       `:',  but  any  character,  or  the  matching  pairs  `(...)', `{...}',
274       `[...]', or `<...>', may be used, but note that  `<...>'  can  only  be
275       used if the subscript is inside a double quoted expression or a parame‐
276       ter substitution enclosed in braces as otherwise the expression is  in‐
277       terpreted as a redirection.
278
279       The flags currently understood are:
280
281       w      If  the  parameter  subscripted is a scalar then this flag makes
282              subscripting work on words instead of characters.   The  default
283              word  separator  is  whitespace.   When combined with the i or I
284              flag, the effect is to produce the index of the first  character
285              of  the  first/last  word  which matches the given pattern; note
286              that a failed match in this case always yields 0.
287
288       s:string:
289              This gives the string that separates words (for use with  the  w
290              flag).  The delimiter character : is arbitrary; see above.
291
292       p      Recognize  the same escape sequences as the print builtin in the
293              string argument of a subsequent `s' flag.
294
295       f      If the parameter subscripted is a scalar then  this  flag  makes
296              subscripting work on lines instead of characters, i.e. with ele‐
297              ments separated by newlines.  This is a shorthand for `pws:\n:'.
298
299       r      Reverse subscripting: if this flag is given, the exp is taken as
300              a  pattern  and  the result is the first matching array element,
301              substring or word (if the parameter is an  array,  if  it  is  a
302              scalar,  or if it is a scalar and the `w' flag is given, respec‐
303              tively).  The subscript used is the number of the matching  ele‐
304              ment,  so  that  pairs of subscripts such as `$foo[(r)??,3]' and
305              `$foo[(r)??,(r)f*]' are possible if the parameter is not an  as‐
306              sociative array.  If the parameter is an associative array, only
307              the value part of each pair is compared to the pattern, and  the
308              result is that value.
309
310              If  a  search  through an ordinary array failed, the search sets
311              the subscript to one past the end of the array, and hence  ${ar‐
312              ray[(r)pattern]}  will  substitute  the  empty string.  Thus the
313              success of a search can be tested by using the (i) flag, for ex‐
314              ample (assuming the option KSH_ARRAYS is not in effect):
315
316                     [[ ${array[(i)pattern]} -le ${#array} ]]
317
318              If KSH_ARRAYS is in effect, the -le should be replaced by -lt.
319
320       R      Like  `r',  but  gives  the last match.  For associative arrays,
321              gives all possible matches. May be used for assigning  to  ordi‐
322              nary  array  elements,  but not for assigning to associative ar‐
323              rays.  On failure, for normal arrays this has the effect of  re‐
324              turning  the element corresponding to subscript 0; this is empty
325              unless one of the options KSH_ARRAYS or KSH_ZERO_SUBSCRIPT is in
326              effect.
327
328              Note that in subscripts with both `r' and `R' pattern characters
329              are active even if they were substituted for  a  parameter  (re‐
330              gardless  of  the setting of GLOB_SUBST which controls this fea‐
331              ture in normal pattern matching).  The flag `e' can be added  to
332              inhibit  pattern  matching.  As this flag does not inhibit other
333              forms of substitution, care is still required; using a parameter
334              to hold the key has the desired effect:
335
336                     key2='original key'
337                     print ${array[(Re)$key2]}
338
339       i      Like `r', but gives the index of the match instead; this may not
340              be combined with a second argument.  On the left side of an  as‐
341              signment,  behaves  like  `r'.   For associative arrays, the key
342              part of each pair is compared to  the  pattern,  and  the  first
343              matching  key  found  is the result.  On failure substitutes the
344              length of the array plus one, as discussed under the description
345              of `r', or the empty string for an associative array.
346
347              Note:  Although  `i'  may be applied to a scalar substitution to
348              find the offset of a substring, the results  are  likely  to  be
349              misleading  when  searching  within  substitutions that yield an
350              empty string, or when searching for the empty substring.
351
352       I      Like `i', but gives the index of the last match, or all possible
353              matching  keys  in an associative array.  On failure substitutes
354              0, or the empty string for an associative array.  This  flag  is
355              best when testing for values or keys that do not exist.
356
357              Note:  If  the  option  KSH_ARRAYS  is in effect and no match is
358              found, the result is indistinguishable from the  case  when  the
359              first element of the array matches.
360
361       k      If used in a subscript on an associative array, this flag causes
362              the keys to be interpreted as patterns, and  returns  the  value
363              for  the  first key found where exp is matched by the key.  Note
364              this could be any such key as no ordering of associative  arrays
365              is  defined.  This flag does not work on the left side of an as‐
366              signment to an associative array element.  If  used  on  another
367              type of parameter, this behaves like `r'.
368
369       K      On  an associative array this is like `k' but returns all values
370              where exp is matched by the keys.  On other types of  parameters
371              this has the same effect as `R'.
372
373       n:expr:
374              If  combined  with `r', `R', `i' or `I', makes them give the nth
375              or nth last match (if expr evaluates to n).  This  flag  is  ig‐
376              nored  when the array is associative.  The delimiter character :
377              is arbitrary; see above.
378
379       b:expr:
380              If combined with `r', `R', `i' or `I', makes them begin  at  the
381              nth  or  nth last element, word, or character (if expr evaluates
382              to n).  This flag is ignored when the array is associative.  The
383              delimiter character : is arbitrary; see above.
384
385       e      This flag causes any pattern matching that would be performed on
386              the subscript to  use  plain  string  matching  instead.   Hence
387              `${array[(re)*]}'  matches only the array element whose value is
388              *.  Note that other forms of substitution such as parameter sub‐
389              stitution are not inhibited.
390
391              This  flag can also be used to force * or @ to be interpreted as
392              a single key rather than as a reference to all values.   It  may
393              be used for either purpose on the left side of an assignment.
394
395       See  Parameter  Expansion Flags (zshexpn(1)) for additional ways to ma‐
396       nipulate the results of array subscripting.
397
398   Subscript Parsing
399       This discussion applies mainly to associative array key strings and  to
400       patterns used for reverse subscripting (the `r', `R', `i', etc. flags),
401       but it may also affect parameter substitutions that appear as  part  of
402       an arithmetic expression in an ordinary subscript.
403
404       To  avoid  subscript  parsing limitations in assignments to associative
405       array elements, use the append syntax:
406
407              aa+=('key with "*strange*" characters' 'value string')
408
409       The basic rule to remember when writing a subscript expression is  that
410       all  text between the opening `[' and the closing `]' is interpreted as
411       if it were in double quotes (see zshmisc(1)).  However,  unlike  double
412       quotes which normally cannot nest, subscript expressions may appear in‐
413       side double-quoted strings or inside other  subscript  expressions  (or
414       both!), so the rules have two important differences.
415
416       The first difference is that brackets (`[' and `]') must appear as bal‐
417       anced pairs in a subscript expression unless they  are  preceded  by  a
418       backslash  (`\').  Therefore, within a subscript expression (and unlike
419       true double-quoting) the sequence `\[' becomes `[', and similarly  `\]'
420       becomes  `]'.  This applies even in cases where a backslash is not nor‐
421       mally required; for example, the pattern `[^[]' (to match any character
422       other than an open bracket) should be written `[^\[]' in a reverse-sub‐
423       script pattern.  However, note that `\[^\[\]' and even `\[^[]' mean the
424       same  thing,  because  backslashes are always stripped when they appear
425       before brackets!
426
427       The same rule applies to parentheses (`(' and `)') and braces (`{'  and
428       `}'):  they must appear either in balanced pairs or preceded by a back‐
429       slash, and backslashes that protect parentheses or braces  are  removed
430       during parsing.  This is because parameter expansions may be surrounded
431       by balanced braces, and subscript  flags  are  introduced  by  balanced
432       parentheses.
433
434       The  second  difference is that a double-quote (`"') may appear as part
435       of a subscript expression without being preceded by  a  backslash,  and
436       therefore  that the two characters `\"' remain as two characters in the
437       subscript (in true double-quoting, `\"' becomes `"').  However, because
438       of the standard shell quoting rules, any double-quotes that appear must
439       occur in balanced pairs unless preceded by a backslash.  This makes  it
440       more  difficult  to  write  a subscript expression that contains an odd
441       number of double-quote characters, but the reason for  this  difference
442       is  so  that  when  a  subscript  expression  appears  inside true dou‐
443       ble-quotes, one can still write `\"' (rather than `\\\"') for `"'.
444
445       To use an odd number of double quotes as a key in  an  assignment,  use
446       the typeset builtin and an enclosing pair of double quotes; to refer to
447       the value of that key, again use double quotes:
448
449              typeset -A aa
450              typeset "aa[one\"two\"three\"quotes]"=QQQ
451              print "$aa[one\"two\"three\"quotes]"
452
453       It is important to note that the quoting rules do not change when a pa‐
454       rameter  expansion  with a subscript is nested inside another subscript
455       expression.  That is, it is not necessary to use additional backslashes
456       within the inner subscript expression; they are removed only once, from
457       the innermost subscript outwards.  Parameters are  also  expanded  from
458       the innermost subscript first, as each expansion is encountered left to
459       right in the outer expression.
460
461       A further complication arises from a way in which subscript parsing  is
462       not  different  from  double quote parsing.  As in true double-quoting,
463       the sequences `\*', and `\@' remain as two characters when they  appear
464       in  a subscript expression.  To use a literal `*' or `@' as an associa‐
465       tive array key, the `e' flag must be used:
466
467              typeset -A aa
468              aa[(e)*]=star
469              print $aa[(e)*]
470
471       A last detail must be considered  when  reverse  subscripting  is  per‐
472       formed.  Parameters appearing in the subscript expression are first ex‐
473       panded and then the complete expression is interpreted  as  a  pattern.
474       This has two effects: first, parameters behave as if GLOB_SUBST were on
475       (and it cannot be turned  off);  second,  backslashes  are  interpreted
476       twice, once when parsing the array subscript and again when parsing the
477       pattern.  In a reverse subscript, it's  necessary  to  use  four  back‐
478       slashes  to cause a single backslash to match literally in the pattern.
479       For complex patterns, it is often easiest to assign the desired pattern
480       to  a  parameter and then refer to that parameter in the subscript, be‐
481       cause then the backslashes, brackets, parentheses, etc., are seen  only
482       when  the  complete expression is converted to a pattern.  To match the
483       value of a parameter literally in a reverse subscript, rather than as a
484       pattern, use `${(q)name}' (see zshexpn(1)) to quote the expanded value.
485
486       Note  that  the `k' and `K' flags are reverse subscripting for an ordi‐
487       nary array, but are not reverse subscripting for an associative  array!
488       (For an associative array, the keys in the array itself are interpreted
489       as patterns by those flags; the subscript is a  plain  string  in  that
490       case.)
491
492       One final note, not directly related to subscripting: the numeric names
493       of positional parameters (described below) are parsed specially, so for
494       example  `$2foo'  is  equivalent  to `${2}foo'.  Therefore, to use sub‐
495       script syntax to extract a substring from a positional  parameter,  the
496       expansion must be surrounded by braces; for example, `${2[3,5]}' evalu‐
497       ates to the third through fifth characters of the second positional pa‐
498       rameter, but `$2[3,5]' is the entire second parameter concatenated with
499       the filename generation pattern `[3,5]'.
500

POSITIONAL PARAMETERS

502       The positional parameters provide access to the command-line  arguments
503       of a shell function, shell script, or the shell itself; see the section
504       `Invocation', and also the section `Functions'.  The parameter n, where
505       n  is a number, is the nth positional parameter.  The parameter `$0' is
506       a special case, see the section `Parameters Set By The Shell'.
507
508       The parameters *, @ and argv are arrays containing all  the  positional
509       parameters;  thus `$argv[n]', etc., is equivalent to simply `$n'.  Note
510       that the options KSH_ARRAYS or KSH_ZERO_SUBSCRIPT apply to these arrays
511       as  well,  so with either of those options set, `${argv[0]}' is equiva‐
512       lent to `$1' and so on.
513
514       Positional parameters may be changed after the shell or function starts
515       by  using the set builtin, by assigning to the argv array, or by direct
516       assignment of the form `n=value' where n is the  number  of  the  posi‐
517       tional  parameter to be changed.  This also creates (with empty values)
518       any of the positions from 1 to n that do not already have values.  Note
519       that, because the positional parameters form an array, an array assign‐
520       ment of the form `n=(value ...)' is allowed,  and  has  the  effect  of
521       shifting  all  the  values at positions greater than n by as many posi‐
522       tions as necessary to accommodate the new values.
523

LOCAL PARAMETERS

525       Shell function executions delimit scopes for shell parameters.  (Param‐
526       eters  are  dynamically scoped.)  The typeset builtin, and its alterna‐
527       tive forms declare, integer, local and readonly (but not  export),  can
528       be used to declare a parameter as being local to the innermost scope.
529
530       When a parameter is read or assigned to, the innermost existing parame‐
531       ter of that name is used.  (That is,  the  local  parameter  hides  any
532       less-local parameter.)  However, assigning to a non-existent parameter,
533       or declaring a new parameter with export, causes it to  be  created  in
534       the outermost scope.
535
536       Local parameters disappear when their scope ends.  unset can be used to
537       delete a parameter while it is still in scope; any outer  parameter  of
538       the same name remains hidden.
539
540       Special  parameters  may  also be made local; they retain their special
541       attributes unless either the existing or  the  newly-created  parameter
542       has  the  -h (hide) attribute.  This may have unexpected effects: there
543       is no default value, so if there is no  assignment  at  the  point  the
544       variable  is  made  local, it will be set to an empty value (or zero in
545       the case of integers).  The following:
546
547              typeset PATH=/new/directory:$PATH
548
549       is valid for temporarily allowing the shell or programmes  called  from
550       it to find the programs in /new/directory inside a function.
551
552       Note  that  the restriction in older versions of zsh that local parame‐
553       ters were never exported has been removed.
554

PARAMETERS SET BY THE SHELL

556       In the parameter lists that follow, the mark `<S>' indicates  that  the
557       parameter  is special.  `<Z>' indicates that the parameter does not ex‐
558       ist when the shell initializes in sh or ksh emulation mode.
559
560       The parameters `!', `#', `*', `-', `?', `@',  `$',  `ARGC',  `HISTCMD',
561       `LINENO',     `PPID',    `status',    `TTYIDLE',    `zsh_eval_context',
562       `ZSH_EVAL_CONTEXT', and `ZSH_SUBSHELL' are read-only and thus cannot be
563       restored  by  the  user,  so they are not output by `typeset -p'.  This
564       also applies to many read-only parameters loaded from modules.
565
566       The following parameters are automatically set by the shell:
567
568       ! <S>  The process ID of the last command  started  in  the  background
569              with  &, put into the background with the bg builtin, or spawned
570              with coproc.
571
572       # <S>  The number of positional parameters in decimal.  Note that  some
573              confusion  may  occur  with the syntax $#param which substitutes
574              the length of param.  Use ${#} to resolve ambiguities.  In  par‐
575              ticular,  the  sequence  `$#-...' in an arithmetic expression is
576              interpreted as the length of the parameter -, q.v.
577
578       ARGC <S> <Z>
579              Same as #.
580
581       $ <S>  The process ID of this shell, set when  the  shell  initializes.
582              Processes forked from the shell without executing a new program,
583              such as command substitutions and commands grouped  with  (...),
584              are subshells that duplicate the current shell, and thus substi‐
585              tute the same value for $$ as their parent shell.
586
587       - <S>  Flags supplied to the shell on invocation or by the set  or  se‐
588              topt commands.
589
590       * <S>  An array containing the positional parameters.
591
592       argv <S> <Z>
593              Same  as  *.  Assigning to argv changes the local positional pa‐
594              rameters, but argv is not itself a  local  parameter.   Deleting
595              argv  with unset in any function deletes it everywhere, although
596              only the innermost positional parameter array is deleted  (so  *
597              and @ in other scopes are not affected).
598
599       @ <S>  Same as argv[@], even when argv is not set.
600
601       ? <S>  The exit status returned by the last command.
602
603       0 <S>  The  name  used to invoke the current shell, or as set by the -c
604              command line option upon invocation.   If  the  FUNCTION_ARGZERO
605              option  is  set, $0 is set upon entry to a shell function to the
606              name of the function, and upon entry to a sourced script to  the
607              name  of  the  script,  and reset to its previous value when the
608              function or script returns.
609
610       status <S> <Z>
611              Same as ?.
612
613       pipestatus <S> <Z>
614              An array containing the exit statuses returned by  all  commands
615              in the last pipeline.
616
617       _ <S>  The last argument of the previous command.  Also, this parameter
618              is set in the environment of every command executed to the  full
619              pathname of the command.
620
621       CPUTYPE
622              The machine type (microprocessor class or machine model), as de‐
623              termined at run time.
624
625       EGID <S>
626              The effective group ID of the shell process.  If you have suffi‐
627              cient  privileges,  you may change the effective group ID of the
628              shell process by assigning to this  parameter.   Also  (assuming
629              sufficient  privileges),  you  may start a single command with a
630              different effective group ID by `(EGID=gid; command)'
631
632              If this is made local, it is not implicitly set to 0, but may be
633              explicitly set locally.
634
635       EUID <S>
636              The  effective user ID of the shell process.  If you have suffi‐
637              cient privileges, you may change the effective user  ID  of  the
638              shell  process  by  assigning to this parameter.  Also (assuming
639              sufficient privileges), you may start a single  command  with  a
640              different effective user ID by `(EUID=uid; command)'
641
642              If this is made local, it is not implicitly set to 0, but may be
643              explicitly set locally.
644
645       ERRNO <S>
646              The value of errno (see errno(3)) as set by  the  most  recently
647              failed  system  call.  This value is system dependent and is in‐
648              tended for debugging purposes.   It  is  also  useful  with  the
649              zsh/system  module  which  allows the number to be turned into a
650              name or message.
651
652              To use this parameter, it must first be assigned a value  (typi‐
653              cally  0  (zero)).  It is initially unset for scripting compati‐
654              bility.
655
656       FUNCNEST <S>
657              Integer.  If greater than or equal to zero, the maximum  nesting
658              depth  of  shell  functions.   When  it is exceeded, an error is
659              raised at the point where a function  is  called.   The  default
660              value  is  determined when the shell is configured, but is typi‐
661              cally 500.  Increasing the value increases the danger of a  run‐
662              away  function  recursion causing the shell to crash.  Setting a
663              negative value turns off the check.
664
665       GID <S>
666              The real group ID of the shell process.  If you have  sufficient
667              privileges,  you may change the group ID of the shell process by
668              assigning to this parameter.  Also (assuming  sufficient  privi‐
669              leges),  you  may start a single command under a different group
670              ID by `(GID=gid; command)'
671
672              If this is made local, it is not implicitly set to 0, but may be
673              explicitly set locally.
674
675       HISTCMD
676              The  current  history  event  number in an interactive shell, in
677              other words  the  event  number  for  the  command  that  caused
678              $HISTCMD  to be read.  If the current history event modifies the
679              history, HISTCMD changes to the new maximum history  event  num‐
680              ber.
681
682       HOST   The current hostname.
683
684       LINENO <S>
685              The  line  number of the current line within the current script,
686              sourced file, or shell function being  executed,  whichever  was
687              started most recently.  Note that in the case of shell functions
688              the line number refers to the function as  it  appeared  in  the
689              original  definition,  not necessarily as displayed by the func‐
690              tions builtin.
691
692       LOGNAME
693              If the corresponding variable is not set in the  environment  of
694              the  shell, it is initialized to the login name corresponding to
695              the current login session. This parameter is exported by default
696              but  this  can be disabled using the typeset builtin.  The value
697              is set to the string returned by the getlogin(3) system call  if
698              that is available.
699
700       MACHTYPE
701              The machine type (microprocessor class or machine model), as de‐
702              termined at compile time.
703
704       OLDPWD The previous working directory.  This is set when the shell ini‐
705              tializes and whenever the directory changes.
706
707       OPTARG <S>
708              The  value  of the last option argument processed by the getopts
709              command.
710
711       OPTIND <S>
712              The index of the last option argument processed by  the  getopts
713              command.
714
715       OSTYPE The operating system, as determined at compile time.
716
717       PPID <S>
718              The  process  ID  of the parent of the shell, set when the shell
719              initializes.  As with $$, the value does not change in subshells
720              created as a duplicate of the current shell.
721
722       PWD    The  present working directory.  This is set when the shell ini‐
723              tializes and whenever the directory changes.
724
725       RANDOM <S>
726              A pseudo-random integer from 0 to 32767,  newly  generated  each
727              time  this parameter is referenced.  The random number generator
728              can be seeded by assigning a numeric value to RANDOM.
729
730              The  values   of   RANDOM   form   an   intentionally-repeatable
731              pseudo-random sequence; subshells that reference RANDOM will re‐
732              sult in identical pseudo-random values unless the value of  RAN‐
733              DOM  is referenced or seeded in the parent shell in between sub‐
734              shell invocations.
735
736       SECONDS <S>
737              The number of seconds since shell invocation.  If this parameter
738              is assigned a value, then the value returned upon reference will
739              be the value that was assigned plus the number of seconds  since
740              the assignment.
741
742              Unlike other special parameters, the type of the SECONDS parame‐
743              ter can be changed using the typeset command.  The type  may  be
744              changed only to one of the floating point types or back to inte‐
745              ger.  For example, `typeset -F SECONDS' causes the value  to  be
746              reported  as a floating point number.  The value is available to
747              microsecond accuracy, although the shell may show more or  fewer
748              digits  depending  on the use of typeset.  See the documentation
749              for the builtin typeset in zshbuiltins(1) for more details.
750
751       SHLVL <S>
752              Incremented by one each time a new shell is started.
753
754       signals
755              An array containing the names of the signals.   Note  that  with
756              the standard zsh numbering of array indices, where the first el‐
757              ement has index 1, the signals are offset by 1 from  the  signal
758              number  used  by  the operating system.  For example, on typical
759              Unix-like systems HUP is signal number 1, but is referred to  as
760              $signals[2].   This  is because of EXIT at position 1 in the ar‐
761              ray, which is used internally by zsh but is not known to the op‐
762              erating system.
763
764       TRY_BLOCK_ERROR <S>
765              In an always block, indicates whether the preceding list of code
766              caused an error.  The value is 1 to indicate an error, 0  other‐
767              wise.   It may be reset, clearing the error condition.  See Com‐
768              plex Commands in zshmisc(1)
769
770       TRY_BLOCK_INTERRUPT <S>
771              This variable works in a similar  way  to  TRY_BLOCK_ERROR,  but
772              represents  the  status  of an interrupt from the signal SIGINT,
773              which typically comes from the keyboard when the user types  ^C.
774              If  set  to  0, any such interrupt will be reset; otherwise, the
775              interrupt is propagated after the always block.
776
777              Note that it is possible that an interrupt  arrives  during  the
778              execution  of  the  always  block; this interrupt is also propa‐
779              gated.
780
781       TTY    The name of the tty associated with the shell, if any.
782
783       TTYIDLE <S>
784              The idle time of the tty associated with the shell in seconds or
785              -1 if there is no such tty.
786
787       UID <S>
788              The  real  user ID of the shell process.  If you have sufficient
789              privileges, you may change the user ID of the shell by assigning
790              to  this  parameter.  Also (assuming sufficient privileges), you
791              may start  a  single  command  under  a  different  user  ID  by
792              `(UID=uid; command)'
793
794              If this is made local, it is not implicitly set to 0, but may be
795              explicitly set locally.
796
797       USERNAME <S>
798              The username corresponding to the real  user  ID  of  the  shell
799              process.   If you have sufficient privileges, you may change the
800              username (and also the user ID and group ID) of the shell by as‐
801              signing  to  this  parameter.   Also (assuming sufficient privi‐
802              leges), you may start a single command under a  different  user‐
803              name  (and  user  ID  and group ID) by `(USERNAME=username; com‐
804              mand)'
805
806       VENDOR The vendor, as determined at compile time.
807
808       zsh_eval_context <S> <Z> (ZSH_EVAL_CONTEXT <S>)
809              An array (colon-separated list) indicating the context of  shell
810              code that is being run.  Each time a piece of shell code that is
811              stored within the shell is executed a string is temporarily  ap‐
812              pended  to  the  array to indicate the type of operation that is
813              being performed.  Read in order the array gives an indication of
814              the  stack of operations being performed with the most immediate
815              context last.
816
817              Note that the variable does not give  information  on  syntactic
818              context  such  as  pipelines or subshells.  Use $ZSH_SUBSHELL to
819              detect subshells.
820
821              The context is one of the following:
822              cmdarg Code specified by the -c option to the command line  that
823                     invoked the shell.
824
825              cmdsubst
826                     Command substitution using the `...` or $(...) construct.
827
828              equalsubst
829                     File substitution using the =(...) construct.
830
831              eval   Code executed by the eval builtin.
832
833              evalautofunc
834                     Code executed with the KSH_AUTOLOAD mechanism in order to
835                     define an autoloaded function.
836
837              fc     Code from the shell history executed by the -e option  to
838                     the fc builtin.
839
840              file   Lines  of code being read directly from a file, for exam‐
841                     ple by the source builtin.
842
843              filecode
844                     Lines of code being read from a .zwc file instead of  di‐
845                     rectly from the source file.
846
847              globqual
848                     Code executed by the e or + glob qualifier.
849
850              globsort
851                     Code executed to order files by the o glob qualifier.
852
853              insubst
854                     File substitution using the <(...) construct.
855
856              loadautofunc
857                     Code  read  directly  from a file to define an autoloaded
858                     function.
859
860              outsubst
861                     File substitution using the >(...) construct.
862
863              sched  Code executed by the sched builtin.
864
865              shfunc A shell function.
866
867              stty   Code passed to stty by  the  STTY  environment  variable.
868                     Normally  this  is  passed  directly to the system's stty
869                     command, so this value is unlikely to be  seen  in  prac‐
870                     tice.
871
872              style  Code  executed as part of a style retrieved by the zstyle
873                     builtin from the zsh/zutil module.
874
875              toplevel
876                     The highest execution level of a  script  or  interactive
877                     shell.
878
879              trap   Code  executed  as  a  trap  defined by the trap builtin.
880                     Traps defined as functions have the context  shfunc.   As
881                     traps  are asynchronous they may have a different hierar‐
882                     chy from other code.
883
884              zpty   Code executed by the zpty builtin from the zsh/zpty  mod‐
885                     ule.
886
887              zregexparse-guard
888                     Code  executed as a guard by the zregexparse command from
889                     the zsh/zutil module.
890
891              zregexparse-action
892                     Code executed as an action  by  the  zregexparse  command
893                     from the zsh/zutil module.
894
895       ZSH_ARGZERO
896              If  zsh  was  invoked  to  run a script, this is the name of the
897              script.  Otherwise, it is the name used to  invoke  the  current
898              shell.    This  is  the  same  as  the  value  of  $0  when  the
899              POSIX_ARGZERO option is set, but is always available.
900
901       ZSH_EXECUTION_STRING
902              If the shell was started with the option -c, this  contains  the
903              argument passed to the option.  Otherwise it is not set.
904
905       ZSH_NAME
906              Expands  to  the basename of the command used to invoke this in‐
907              stance of zsh.
908
909       ZSH_PATCHLEVEL
910              The output of `git describe --tags --long' for the  zsh  reposi‐
911              tory  used  to build the shell.  This is most useful in order to
912              keep track of versions of the shell during  development  between
913              releases;  hence most users should not use it and should instead
914              rely on $ZSH_VERSION.
915
916       zsh_scheduled_events
917              See the section `The zsh/sched Module' in zshmodules(1).
918
919       ZSH_SCRIPT
920              If zsh was invoked to run a script, this  is  the  name  of  the
921              script, otherwise it is unset.
922
923       ZSH_SUBSHELL
924              Readonly  integer.   Initially  zero,  incremented each time the
925              shell forks to create a  subshell  for  executing  code.   Hence
926              `(print  $ZSH_SUBSHELL)' and `print $(print $ZSH_SUBSHELL)' out‐
927              put 1, while `( (print $ZSH_SUBSHELL) )' outputs 2.
928
929       ZSH_VERSION
930              The version number of the release of zsh.
931

PARAMETERS USED BY THE SHELL

933       The following parameters are used by the shell.  Again, `<S>' indicates
934       that  the  parameter  is special and `<Z>' indicates that the parameter
935       does not exist when the shell initializes in sh or ksh emulation mode.
936
937       In cases where there are two parameters with an  upper-  and  lowercase
938       form  of the same name, such as path and PATH, the lowercase form is an
939       array and the uppercase form is a scalar with the elements of the array
940       joined  together  by colons.  These are similar to tied parameters cre‐
941       ated via `typeset -T'.  The normal use for the colon-separated form  is
942       for exporting to the environment, while the array form is easier to ma‐
943       nipulate within the shell.  Note that unsetting either of the pair will
944       unset  the  other; they retain their special properties when recreated,
945       and recreating one of the pair will recreate the other.
946
947       ARGV0  If exported, its value is used as the argv[0] of  external  com‐
948              mands.  Usually used in constructs like `ARGV0=emacs nethack'.
949
950       BAUD   The  rate in bits per second at which data reaches the terminal.
951              The line editor will use this value in order to compensate for a
952              slow  terminal  by  delaying updates to the display until neces‐
953              sary.  If the parameter is unset or the value is zero  the  com‐
954              pensation  mechanism is turned off.  The parameter is not set by
955              default.
956
957              This parameter may be profitably set in some circumstances, e.g.
958              for  slow  modems  dialing into a communications server, or on a
959              slow wide area network.  It should be set to the  baud  rate  of
960              the slowest part of the link for best performance.
961
962       cdpath <S> <Z> (CDPATH <S>)
963              An  array  (colon-separated  list) of directories specifying the
964              search path for the cd command.
965
966       COLUMNS <S>
967              The number of columns  for  this  terminal  session.   Used  for
968              printing select lists and for the line editor.
969
970       CORRECT_IGNORE
971              If set, is treated as a pattern during spelling correction.  Any
972              potential correction that matches the pattern is  ignored.   For
973              example,  if the value is `_*' then completion functions (which,
974              by convention, have names beginning with `_') will never be  of‐
975              fered  as  spelling  corrections.  The pattern does not apply to
976              the correction of file names, as applied by the CORRECT_ALL  op‐
977              tion (so with the example just given files beginning with `_' in
978              the current directory would still be completed).
979
980       CORRECT_IGNORE_FILE
981              If set, is treated as a pattern during  spelling  correction  of
982              file names.  Any file name that matches the pattern is never of‐
983              fered as a correction.  For example, if the value is  `.*'  then
984              dot  file  names  will never be offered as spelling corrections.
985              This is useful with the CORRECT_ALL option.
986
987       DIRSTACKSIZE
988              The maximum size of the directory stack, by default there is  no
989              limit.  If the stack gets larger than this, it will be truncated
990              automatically.  This is useful with the AUTO_PUSHD option.
991
992       ENV    If the ENV environment variable is set when zsh is invoked as sh
993              or ksh, $ENV is sourced after the profile scripts.  The value of
994              ENV is subjected to parameter expansion,  command  substitution,
995              and arithmetic expansion before being interpreted as a pathname.
996              Note that ENV is not used unless the shell  is  interactive  and
997              zsh is emulating sh or ksh.
998
999       FCEDIT The  default  editor  for the fc builtin.  If FCEDIT is not set,
1000              the parameter EDITOR is used; if  that  is  not  set  either,  a
1001              builtin default, usually vi, is used.
1002
1003       fignore <S> <Z> (FIGNORE <S>)
1004              An array (colon separated list) containing the suffixes of files
1005              to be ignored during filename completion.  However,  if  comple‐
1006              tion only generates files with suffixes in this list, then these
1007              files are completed anyway.
1008
1009       fpath <S> <Z> (FPATH <S>)
1010              An array (colon separated list) of  directories  specifying  the
1011              search  path  for  function  definitions.  This path is searched
1012              when a function with the -u attribute is referenced.  If an exe‐
1013              cutable  file is found, then it is read and executed in the cur‐
1014              rent environment.
1015
1016       histchars <S>
1017              Three characters used by the shell's history and lexical  analy‐
1018              sis  mechanism.  The first character signals the start of a his‐
1019              tory expansion (default `!').  The second character signals  the
1020              start  of a quick history substitution (default `^').  The third
1021              character is the comment character (default `#').
1022
1023              The characters must be in the ASCII character set;  any  attempt
1024              to  set  histchars to characters with a locale-dependent meaning
1025              will be rejected with an error message.
1026
1027       HISTCHARS <S> <Z>
1028              Same as histchars.  (Deprecated.)
1029
1030       HISTFILE
1031              The file to save the history in when an interactive shell exits.
1032              If unset, the history is not saved.
1033
1034       HISTORY_IGNORE
1035              If  set,  is  treated as a pattern at the time history files are
1036              written.  Any potential history entry that matches  the  pattern
1037              is  skipped.   For example, if the value is `fc *' then commands
1038              that invoke the interactive history editor are never written  to
1039              the history file.
1040
1041              Note  that  HISTORY_IGNORE  defines a single pattern: to specify
1042              alternatives use the `(first|second|...)' syntax.
1043
1044              Compare the HIST_NO_STORE option or the zshaddhistory hook,  ei‐
1045              ther  of  which  would prevent such commands from being added to
1046              the interactive history at all.  If you wish to use  HISTORY_IG‐
1047              NORE to stop history being added in the first place, you can de‐
1048              fine the following hook:
1049
1050                     zshaddhistory() {
1051                       emulate -L zsh
1052                       ## uncomment if HISTORY_IGNORE
1053                       ## should use EXTENDED_GLOB syntax
1054                       # setopt extendedglob
1055                       [[ $1 != ${~HISTORY_IGNORE} ]]
1056                     }
1057
1058       HISTSIZE <S>
1059              The maximum number of events  stored  in  the  internal  history
1060              list.   If  you  use  the HIST_EXPIRE_DUPS_FIRST option, setting
1061              this value larger than the SAVEHIST size will give you the  dif‐
1062              ference as a cushion for saving duplicated history events.
1063
1064              If this is made local, it is not implicitly set to 0, but may be
1065              explicitly set locally.
1066
1067       HOME <S>
1068              The default argument for the cd command.  This is not set  auto‐
1069              matically  by  the  shell in sh, ksh or csh emulation, but it is
1070              typically present in the environment anyway, and if  it  becomes
1071              set it has its usual special behaviour.
1072
1073       IFS <S>
1074              Internal  field  separators  (by default space, tab, newline and
1075              NUL), that are used to separate words which result from  command
1076              or  parameter expansion and words read by the read builtin.  Any
1077              characters from the set space, tab and newline  that  appear  in
1078              the IFS are called IFS white space.  One or more IFS white space
1079              characters or one non-IFS white space  character  together  with
1080              any  adjacent  IFS white space character delimit a field.  If an
1081              IFS white space character appears  twice  consecutively  in  the
1082              IFS,  this  character  is treated as if it were not an IFS white
1083              space character.
1084
1085              If the parameter is unset, the default is used.  Note this has a
1086              different effect from setting the parameter to an empty string.
1087
1088       KEYBOARD_HACK
1089              This  variable defines a character to be removed from the end of
1090              the command line  before  interpreting  it  (interactive  shells
1091              only). It is intended to fix the problem with keys placed annoy‐
1092              ingly close to return and replaces  the  SUNKEYBOARDHACK  option
1093              which did this for backquotes only.  Should the chosen character
1094              be one of singlequote, doublequote or backquote, there must also
1095              be an odd number of them on the command line for the last one to
1096              be removed.
1097
1098              For backward compatibility, if the SUNKEYBOARDHACK option is ex‐
1099              plicitly  set,  the value of KEYBOARD_HACK reverts to backquote.
1100              If the option is explicitly  unset,  this  variable  is  set  to
1101              empty.
1102
1103       KEYTIMEOUT
1104              The  time the shell waits, in hundredths of seconds, for another
1105              key to be pressed when reading bound multi-character sequences.
1106
1107       LANG <S>
1108              This variable determines the locale category  for  any  category
1109              not specifically selected via a variable starting with `LC_'.
1110
1111       LC_ALL <S>
1112              This variable overrides the value of the `LANG' variable and the
1113              value of any of the other variables starting with `LC_'.
1114
1115       LC_COLLATE <S>
1116              This variable determines the locale category for character  col‐
1117              lation  information within ranges in glob brackets and for sort‐
1118              ing.
1119
1120       LC_CTYPE <S>
1121              This variable determines the locale category for character  han‐
1122              dling  functions.   If  the  MULTIBYTE  option is in effect this
1123              variable or LANG should contain a value that reflects the  char‐
1124              acter set in use, even if it is a single-byte character set, un‐
1125              less only the 7-bit subset (ASCII) is used.  For example, if the
1126              character   set   is  ISO-8859-1,  a  suitable  value  might  be
1127              en_US.iso88591 (certain Linux distributions) or  en_US.ISO8859-1
1128              (MacOS).
1129
1130       LC_MESSAGES <S>
1131              This  variable  determines the language in which messages should
1132              be written.  Note that zsh does not use message catalogs.
1133
1134       LC_NUMERIC <S>
1135              This variable affects the decimal point character and  thousands
1136              separator character for the formatted input/output functions and
1137              string conversion functions.  Note that zsh ignores this setting
1138              when parsing floating point mathematical expressions.
1139
1140       LC_TIME <S>
1141              This  variable  determines the locale category for date and time
1142              formatting in prompt escape sequences.
1143
1144       LINES <S>
1145              The number of lines for this terminal session.  Used for  print‐
1146              ing select lists and for the line editor.
1147
1148       LISTMAX
1149              In the line editor, the number of matches to list without asking
1150              first. If the value is negative, the list will be  shown  if  it
1151              spans  at most as many lines as given by the absolute value.  If
1152              set to zero, the shell asks only if the top of the listing would
1153              scroll off the screen.
1154
1155       MAIL   If  this  parameter  is  set  and mailpath is not set, the shell
1156              looks for mail in the specified file.
1157
1158       MAILCHECK
1159              The interval in seconds between checks for new mail.
1160
1161       mailpath <S> <Z> (MAILPATH <S>)
1162              An array (colon-separated list) of filenames to  check  for  new
1163              mail.  Each filename can be followed by a `?' and a message that
1164              will be printed.  The message will undergo parameter  expansion,
1165              command  substitution and arithmetic expansion with the variable
1166              $_ defined as the name of the file that has  changed.   The  de‐
1167              fault message is `You have new mail'.  If an element is a direc‐
1168              tory instead of a file the shell will  recursively  check  every
1169              file in every subdirectory of the element.
1170
1171       manpath <S> <Z> (MANPATH <S> <Z>)
1172              An  array  (colon-separated list) whose value is not used by the
1173              shell.  The manpath array can be useful, however, since  setting
1174              it also sets MANPATH, and vice versa.
1175
1176       match
1177       mbegin
1178       mend   Arrays set by the shell when the b globbing flag is used in pat‐
1179              tern matches.  See the subsection Globbing flags in the documen‐
1180              tation for Filename Generation in zshexpn(1).
1181
1182       MATCH
1183       MBEGIN
1184       MEND   Set  by  the  shell  when the m globbing flag is used in pattern
1185              matches.  See the subsection Globbing flags in the documentation
1186              for Filename Generation in zshexpn(1).
1187
1188       module_path <S> <Z> (MODULE_PATH <S>)
1189              An  array  (colon-separated  list)  of directories that zmodload
1190              searches for dynamically loadable modules.  This is  initialized
1191              to  a  standard  pathname, usually `/usr/local/lib/zsh/$ZSH_VER‐
1192              SION'.  (The `/usr/local/lib' part varies from  installation  to
1193              installation.)  For security reasons, any value set in the envi‐
1194              ronment when the shell is started will be ignored.
1195
1196              These parameters only exist if the installation supports dynamic
1197              module loading.
1198
1199       NULLCMD <S>
1200              The command name to assume if a redirection is specified with no
1201              command.  Defaults to cat.  For sh/ksh behavior, change this  to
1202              :.   For csh-like behavior, unset this parameter; the shell will
1203              print an error message if null commands are entered.
1204
1205       path <S> <Z> (PATH <S>)
1206              An array (colon-separated list) of  directories  to  search  for
1207              commands.  When this parameter is set, each directory is scanned
1208              and all files found are put in a hash table.
1209
1210       POSTEDIT <S>
1211              This string is output whenever the line editor exits.   It  usu‐
1212              ally contains termcap strings to reset the terminal.
1213
1214       PROMPT <S> <Z>
1215       PROMPT2 <S> <Z>
1216       PROMPT3 <S> <Z>
1217       PROMPT4 <S> <Z>
1218              Same as PS1, PS2, PS3 and PS4, respectively.
1219
1220       prompt <S> <Z>
1221              Same as PS1.
1222
1223       PROMPT_EOL_MARK
1224              When   the   PROMPT_CR   and  PROMPT_SP  options  are  set,  the
1225              PROMPT_EOL_MARK parameter can be used to customize how  the  end
1226              of partial lines are shown.  This parameter undergoes prompt ex‐
1227              pansion, with the PROMPT_PERCENT option set.  If  not  set,  the
1228              default behavior is equivalent to the value `%B%S%#%s%b'.
1229
1230       PS1 <S>
1231              The primary prompt string, printed before a command is read.  It
1232              undergoes a special form of expansion  before  being  displayed;
1233              see EXPANSION OF PROMPT SEQUENCES in zshmisc(1).  The default is
1234              `%m%# '.
1235
1236       PS2 <S>
1237              The secondary prompt, printed when the shell needs more informa‐
1238              tion  to  complete a command.  It is expanded in the same way as
1239              PS1.  The default is `%_> ', which displays any shell constructs
1240              or quotation marks which are currently being processed.
1241
1242       PS3 <S>
1243              Selection  prompt  used within a select loop.  It is expanded in
1244              the same way as PS1.  The default is `?# '.
1245
1246       PS4 <S>
1247              The execution trace prompt.  Default is `+%N:%i> ',  which  dis‐
1248              plays  the name of the current shell structure and the line num‐
1249              ber within it.  In sh or ksh emulation, the default is `+ '.
1250
1251       psvar <S> <Z> (PSVAR <S>)
1252              An array (colon-separated list) whose elements can  be  used  in
1253              PROMPT strings.  Setting psvar also sets PSVAR, and vice versa.
1254
1255       READNULLCMD <S>
1256              The  command  name  to  assume  if a single input redirection is
1257              specified with no command.  Defaults to more.
1258
1259       REPORTMEMORY
1260              If  nonnegative,  commands  whose  maximum  resident  set   size
1261              (roughly  speaking,  main  memory usage) in kilobytes is greater
1262              than this value have timing  statistics  reported.   The  format
1263              used to output statistics is the value of the TIMEFMT parameter,
1264              which is the same as for the REPORTTIME variable  and  the  time
1265              builtin; note that by default this does not output memory usage.
1266              Appending " max RSS %M" to the value of  TIMEFMT  causes  it  to
1267              output  the  value  that triggered the report.  If REPORTTIME is
1268              also in use, at most a single report is printed for  both  trig‐
1269              gers.   This  feature requires the getrusage() system call, com‐
1270              monly supported by modern Unix-like systems.
1271
1272       REPORTTIME
1273              If nonnegative, commands whose combined user and  system  execu‐
1274              tion  times  (measured  in  seconds) are greater than this value
1275              have timing statistics printed for them.  Output  is  suppressed
1276              for  commands executed within the line editor, including comple‐
1277              tion; commands explicitly marked with  the  time  keyword  still
1278              cause the summary to be printed in this case.
1279
1280       REPLY  This  parameter  is reserved by convention to pass string values
1281              between shell scripts and shell builtins in situations  where  a
1282              function call or redirection are impossible or undesirable.  The
1283              read builtin and the select complex command may set  REPLY,  and
1284              filename generation both sets and examines its value when evalu‐
1285              ating certain expressions.  Some modules also employ  REPLY  for
1286              similar purposes.
1287
1288       reply  As REPLY, but for array values rather than strings.
1289
1290       RPROMPT <S>
1291       RPS1 <S>
1292              This  prompt  is  displayed on the right-hand side of the screen
1293              when the primary prompt is being displayed on  the  left.   This
1294              does  not  work if the SINGLE_LINE_ZLE option is set.  It is ex‐
1295              panded in the same way as PS1.
1296
1297       RPROMPT2 <S>
1298       RPS2 <S>
1299              This prompt is displayed on the right-hand side  of  the  screen
1300              when  the secondary prompt is being displayed on the left.  This
1301              does not work if the SINGLE_LINE_ZLE option is set.  It  is  ex‐
1302              panded in the same way as PS2.
1303
1304       SAVEHIST
1305              The  maximum  number  of  history  events to save in the history
1306              file.
1307
1308              If this is made local, it is not implicitly set to 0, but may be
1309              explicitly set locally.
1310
1311       SPROMPT <S>
1312              The  prompt used for spelling correction.  The sequence `%R' ex‐
1313              pands to the string which presumably needs spelling  correction,
1314              and  `%r'  expands to the proposed correction.  All other prompt
1315              escapes are also allowed.
1316
1317              The actions available at the prompt are [nyae]:
1318              n (`no') (default)
1319                     Discard the correction and run the command.
1320              y (`yes')
1321                     Make the correction and run the command.
1322              a (`abort')
1323                     Discard the entire command line without running it.
1324              e (`edit')
1325                     Resume editing the command line.
1326
1327       STTY   If this parameter is set in a command's environment,  the  shell
1328              runs  the stty command with the value of this parameter as argu‐
1329              ments in order to set up the terminal before executing the  com‐
1330              mand. The modes apply only to the command, and are reset when it
1331              finishes or is suspended. If the command is suspended  and  con‐
1332              tinued  later with the fg or wait builtins it will see the modes
1333              specified by STTY, as if it were not  suspended.   This  (inten‐
1334              tionally)  does  not apply if the command is continued via `kill
1335              -CONT'.  STTY is ignored if the command  is  run  in  the  back‐
1336              ground,  or if it is in the environment of the shell but not ex‐
1337              plicitly assigned to in the input line. This avoids running stty
1338              at  every  external  command  by accidentally exporting it. Also
1339              note that STTY should not be used  for  window  size  specifica‐
1340              tions; these will not be local to the command.
1341
1342              If  the parameter is set and empty, all of the above applies ex‐
1343              cept that stty is not run. This can be useful as a way to freeze
1344              the  tty  around  a  single command, blocking its changes to tty
1345              settings, similar to the ttyctl builtin.
1346
1347       TERM <S>
1348              The type of terminal in use.  This is used when looking up term‐
1349              cap  sequences.  An assignment to TERM causes zsh to re-initial‐
1350              ize the terminal, even if  the  value  does  not  change  (e.g.,
1351              `TERM=$TERM').   It is necessary to make such an assignment upon
1352              any change to the terminal definition database or terminal  type
1353              in order for the new settings to take effect.
1354
1355       TERMINFO <S>
1356              A  reference  to  your terminfo database, used by the `terminfo'
1357              library when the system has it; see terminfo(5).  If  set,  this
1358              causes  the shell to reinitialise the terminal, making the work‐
1359              around `TERM=$TERM' unnecessary.
1360
1361       TERMINFO_DIRS <S>
1362              A colon-seprarated list of terminfo databases, used by the `ter‐
1363              minfo'  library  when  the  system has it; see terminfo(5). This
1364              variable is only used by certain terminal libraries, in particu‐
1365              lar  ncurses;  see  terminfo(5) to check support on your system.
1366              If set, this causes the shell to reinitialise the terminal, mak‐
1367              ing  the  workaround `TERM=$TERM' unnecessary.  Note that unlike
1368              other colon-separated arrays this is not tied to a zsh array.
1369
1370       TIMEFMT
1371              The format of process time reports with the time  keyword.   The
1372              default is `%J  %U user %S system %P cpu %*E total'.  Recognizes
1373              the following escape sequences, although not all may  be  avail‐
1374              able on all systems, and some that are available may not be use‐
1375              ful:
1376
1377              %%     A `%'.
1378              %U     CPU seconds spent in user mode.
1379              %S     CPU seconds spent in kernel mode.
1380              %E     Elapsed time in seconds.
1381              %P     The CPU percentage, computed as 100*(%U+%S)/%E.
1382              %W     Number of times the process was swapped.
1383              %X     The average amount in (shared) text space used  in  kilo‐
1384                     bytes.
1385              %D     The average amount in (unshared) data/stack space used in
1386                     kilobytes.
1387              %K     The total space used (%X+%D) in kilobytes.
1388              %M     The  maximum memory the process had in use at any time in
1389                     kilobytes.
1390              %F     The  number  of  major  page  faults  (page  needed to be
1391                     brought from disk).
1392              %R     The number of minor page faults.
1393              %I     The number of input operations.
1394              %O     The number of output operations.
1395              %r     The number of socket messages received.
1396              %s     The number of socket messages sent.
1397              %k     The number of signals received.
1398              %w     Number of voluntary context switches (waits).
1399              %c     Number of involuntary context switches.
1400              %J     The name of this job.
1401
1402              A star may be inserted between the percent sign and flags print‐
1403              ing  time  (e.g.,  `%*E'); this causes the time to be printed in
1404              `hh:mm:ss.ttt' format (hours and minutes  are  only  printed  if
1405              they  are  not  zero).   Alternatively,  `m'  or `u' may be used
1406              (e.g., `%mE') to produce time  output  in  milliseconds  or  mi‐
1407              croseconds, respectively.
1408
1409       TMOUT  If  this  parameter  is  nonzero, the shell will receive an ALRM
1410              signal if a command is not entered within the  specified  number
1411              of  seconds  after  issuing  a  prompt.  If  there  is a trap on
1412              SIGALRM, it will be executed and a new alarm is scheduled  using
1413              the  value  of the TMOUT parameter after executing the trap.  If
1414              no trap is set, and the idle time of the terminal  is  not  less
1415              than  the  value of the TMOUT parameter, zsh terminates.  Other‐
1416              wise a new alarm is scheduled to TMOUT seconds  after  the  last
1417              keypress.
1418
1419       TMPPREFIX
1420              A  pathname  prefix  which  the shell will use for all temporary
1421              files.  Note that this should include an initial  part  for  the
1422              file  name  as  well  as  any  directory  names.  The default is
1423              `/tmp/zsh'.
1424
1425       TMPSUFFIX
1426              A filename suffix which the shell will use for  temporary  files
1427              created  by  process substitutions (e.g., `=(list)').  Note that
1428              the value should include a leading dot `.' if intended to be in‐
1429              terpreted as a file extension.  The default is not to append any
1430              suffix, thus this parameter should be assigned only when  needed
1431              and then unset again.
1432
1433       WORDCHARS <S>
1434              A  list of non-alphanumeric characters considered part of a word
1435              by the line editor.
1436
1437       ZBEEP  If set, this gives a string of characters, which can use all the
1438              same  codes  as  the bindkey command as described in the zsh/zle
1439              module entry in zshmodules(1), that will be output to the termi‐
1440              nal  instead  of beeping.  This may have a visible instead of an
1441              audible effect; for example,  the  string  `\e[?5h\e[?5l'  on  a
1442              vt100 or xterm will have the effect of flashing reverse video on
1443              and off (if you usually use reverse video, you  should  use  the
1444              string  `\e[?5l\e[?5h' instead).  This takes precedence over the
1445              NOBEEP option.
1446
1447       ZDOTDIR
1448              The directory to search for shell startup files  (.zshrc,  etc),
1449              if not $HOME.
1450
1451       zle_bracketed_paste
1452              Many  terminal emulators have a feature that allows applications
1453              to identify when text is pasted into the  terminal  rather  than
1454              being  typed  normally. For ZLE, this means that special charac‐
1455              ters such as tabs and newlines can be inserted instead of invok‐
1456              ing  editor  commands.   Furthermore, pasted text forms a single
1457              undo event and if the region is active, pasted text will replace
1458              the region.
1459
1460              This  two-element  array  contains the terminal escape sequences
1461              for enabling and disabling the feature. These  escape  sequences
1462              are  used  to enable bracketed paste when ZLE is active and dis‐
1463              able it at other times.  Unsetting the parameter has the  effect
1464              of ensuring that bracketed paste remains disabled.
1465
1466       zle_highlight
1467              An  array  describing contexts in which ZLE should highlight the
1468              input text.  See Character Highlighting in zshzle(1).
1469
1470       ZLE_LINE_ABORTED
1471              This parameter is set by the line editor when an  error  occurs.
1472              It  contains  the line that was being edited at the point of the
1473              error.  `print -zr -- $ZLE_LINE_ABORTED' can be used to  recover
1474              the line.  Only the most recent line of this kind is remembered.
1475
1476       ZLE_REMOVE_SUFFIX_CHARS
1477       ZLE_SPACE_SUFFIX_CHARS
1478              These  parameters  are used by the line editor.  In certain cir‐
1479              cumstances suffixes (typically space or slash) added by the com‐
1480              pletion system will be removed automatically, either because the
1481              next editing command was not an insertable character, or because
1482              the character was marked as requiring the suffix to be removed.
1483
1484              These  variables  can  contain  the sets of characters that will
1485              cause the suffix to be removed.  If  ZLE_REMOVE_SUFFIX_CHARS  is
1486              set,  those  characters  will cause the suffix to be removed; if
1487              ZLE_SPACE_SUFFIX_CHARS is set, those characters will  cause  the
1488              suffix to be removed and replaced by a space.
1489
1490              If  ZLE_REMOVE_SUFFIX_CHARS is not set, the default behaviour is
1491              equivalent to:
1492
1493                     ZLE_REMOVE_SUFFIX_CHARS=$' \t\n;&|'
1494
1495              If ZLE_REMOVE_SUFFIX_CHARS is set but is  empty,  no  characters
1496              have  this  behaviour.  ZLE_SPACE_SUFFIX_CHARS takes precedence,
1497              so that the following:
1498
1499                     ZLE_SPACE_SUFFIX_CHARS=$'&|'
1500
1501              causes the characters `&' and `|' to remove the  suffix  but  to
1502              replace it with a space.
1503
1504              To  illustrate  the difference, suppose that the option AUTO_RE‐
1505              MOVE_SLASH is in effect and the directory DIR has just been com‐
1506              pleted,  with an appended /, following which the user types `&'.
1507              The default result is `DIR&'.  With ZLE_REMOVE_SUFFIX_CHARS  set
1508              but   without   including  `&'  the  result  is  `DIR/&'.   With
1509              ZLE_SPACE_SUFFIX_CHARS set to include `&' the result is `DIR &'.
1510
1511              Note that certain completions may provide their own  suffix  re‐
1512              moval  or  replacement  behaviour which overrides the values de‐
1513              scribed here.  See the completion system documentation  in  zsh‐
1514              compsys(1).
1515
1516       ZLE_RPROMPT_INDENT <S>
1517              If set, used to give the indentation between the right hand side
1518              of the right prompt in the line  editor  as  given  by  RPS1  or
1519              RPROMPT  and the right hand side of the screen.  If not set, the
1520              value 1 is used.
1521
1522              Typically this will be used to set the value to 0  so  that  the
1523              prompt  appears  flush  with  the right hand side of the screen.
1524              This is not the default as many terminals  do  not  handle  this
1525              correctly,  in particular when the prompt appears at the extreme
1526              bottom right of the screen.  Recent virtual terminals  are  more
1527              likely  to  handle this case correctly.  Some experimentation is
1528              necessary.
1529
1530
1531
1532zsh 5.9                          May 14, 2022                      ZSHPARAM(1)
Impressum