1ZSHOPTIONS(1) General Commands Manual ZSHOPTIONS(1)
2
3
4
6 zshoptions - zsh options
7
9 Options are primarily referred to by name. These names are case insen‐
10 sitive and underscores are ignored. For example, `allexport' is equiv‐
11 alent to `A__lleXP_ort'.
12
13 The sense of an option name may be inverted by preceding it with `no',
14 so `setopt No_Beep' is equivalent to `unsetopt beep'. This inversion
15 can only be done once, so `nonobeep' is not a synonym for `beep'. Sim‐
16 ilarly, `tify' is not a synonym for `nonotify' (the inversion of `no‐
17 tify').
18
19 Some options also have one or more single letter names. There are two
20 sets of single letter options: one used by default, and another used to
21 emulate sh/ksh (used when the SH_OPTION_LETTERS option is set). The
22 single letter options can be used on the shell command line, or with
23 the set, setopt and unsetopt builtins, as normal Unix options preceded
24 by `-'.
25
26 The sense of the single letter options may be inverted by using `+' in‐
27 stead of `-'. Some of the single letter option names refer to an op‐
28 tion being off, in which case the inversion of that name refers to the
29 option being on. For example, `+n' is the short name of `exec', and
30 `-n' is the short name of its inversion, `noexec'.
31
32 In strings of single letter options supplied to the shell at startup,
33 trailing whitespace will be ignored; for example the string `-f '
34 will be treated just as `-f', but the string `-f i' is an error. This
35 is because many systems which implement the `#!' mechanism for calling
36 scripts do not strip trailing whitespace.
37
39 In the following list, options set by default in all emulations are
40 marked <D>; those set by default only in csh, ksh, sh, or zsh emula‐
41 tions are marked <C>, <K>, <S>, <Z> as appropriate. When listing op‐
42 tions (by `setopt', `unsetopt', `set -o' or `set +o'), those turned on
43 by default appear in the list prefixed with `no'. Hence (unless
44 KSH_OPTION_PRINT is set), `setopt' shows all options whose settings are
45 changed from the default.
46
47 Changing Directories
48 AUTO_CD (-J)
49 If a command is issued that can't be executed as a normal com‐
50 mand, and the command is the name of a directory, perform the cd
51 command to that directory. This option is only applicable if
52 the option SHIN_STDIN is set, i.e. if commands are being read
53 from standard input. The option is designed for interactive
54 use; it is recommended that cd be used explicitly in scripts to
55 avoid ambiguity.
56
57 AUTO_PUSHD (-N)
58 Make cd push the old directory onto the directory stack.
59
60 CDABLE_VARS (-T)
61 If the argument to a cd command (or an implied cd with the
62 AUTO_CD option set) is not a directory, and does not begin with
63 a slash, try to expand the expression as if it were preceded by
64 a `~' (see the section `Filename Expansion').
65
66 CD_SILENT
67 Never print the working directory after a cd (whether explicit
68 or implied with the AUTO_CD option set). cd normally prints the
69 working directory when the argument given to it was -, a stack
70 entry, or the name of a directory found under CDPATH. Note that
71 this is distinct from pushd's stack-printing behaviour, which is
72 controlled by PUSHD_SILENT. This option overrides the print‐
73 ing-related effects of POSIX_CD.
74
75 CHASE_DOTS
76 When changing to a directory containing a path segment `..'
77 which would otherwise be treated as canceling the previous seg‐
78 ment in the path (in other words, `foo/..' would be removed from
79 the path, or if `..' is the first part of the path, the last
80 part of the current working directory would be removed), instead
81 resolve the path to the physical directory. This option is
82 overridden by CHASE_LINKS.
83
84 For example, suppose /foo/bar is a link to the directory
85 /alt/rod. Without this option set, `cd /foo/bar/..' changes to
86 /foo; with it set, it changes to /alt. The same applies if the
87 current directory is /foo/bar and `cd ..' is used. Note that
88 all other symbolic links in the path will also be resolved.
89
90 CHASE_LINKS (-w)
91 Resolve symbolic links to their true values when changing direc‐
92 tory. This also has the effect of CHASE_DOTS, i.e. a `..' path
93 segment will be treated as referring to the physical parent,
94 even if the preceding path segment is a symbolic link.
95
96 POSIX_CD <K> <S>
97 Modifies the behaviour of cd, chdir and pushd commands to make
98 them more compatible with the POSIX standard. The behaviour with
99 the option unset is described in the documentation for the cd
100 builtin in zshbuiltins(1). If the option is set, the shell does
101 not test for directories beneath the local directory (`.') until
102 after all directories in cdpath have been tested, and the cd and
103 chdir commands do not recognise arguments of the form `{+|-}n'
104 as directory stack entries.
105
106 Also, if the option is set, the conditions under which the shell
107 prints the new directory after changing to it are modified. It
108 is no longer restricted to interactive shells (although printing
109 of the directory stack with pushd is still limited to interac‐
110 tive shells); and any use of a component of CDPATH, including a
111 `.' but excluding an empty component that is otherwise treated
112 as `.', causes the directory to be printed.
113
114 PUSHD_IGNORE_DUPS
115 Don't push multiple copies of the same directory onto the direc‐
116 tory stack.
117
118 PUSHD_MINUS
119 Exchanges the meanings of `+' and `-' when used with a number to
120 specify a directory in the stack.
121
122 PUSHD_SILENT (-E)
123 Do not print the directory stack after pushd or popd.
124
125 PUSHD_TO_HOME (-D)
126 Have pushd with no arguments act like `pushd $HOME'.
127
128 Completion
129 ALWAYS_LAST_PROMPT <D>
130 If unset, key functions that list completions try to return to
131 the last prompt if given a numeric argument. If set these func‐
132 tions try to return to the last prompt if given no numeric argu‐
133 ment.
134
135 ALWAYS_TO_END
136 If a completion is performed with the cursor within a word, and
137 a full completion is inserted, the cursor is moved to the end of
138 the word. That is, the cursor is moved to the end of the word
139 if either a single match is inserted or menu completion is per‐
140 formed.
141
142 AUTO_LIST (-9) <D>
143 Automatically list choices on an ambiguous completion.
144
145 AUTO_MENU <D>
146 Automatically use menu completion after the second consecutive
147 request for completion, for example by pressing the tab key re‐
148 peatedly. This option is overridden by MENU_COMPLETE.
149
150 AUTO_NAME_DIRS
151 Any parameter that is set to the absolute name of a directory
152 immediately becomes a name for that directory, that will be used
153 by the `%~' and related prompt sequences, and will be available
154 when completion is performed on a word starting with `~'. (Oth‐
155 erwise, the parameter must be used in the form `~param' first.)
156
157 AUTO_PARAM_KEYS <D>
158 If a parameter name was completed and a following character
159 (normally a space) automatically inserted, and the next charac‐
160 ter typed is one of those that have to come directly after the
161 name (like `}', `:', etc.), the automatically added character is
162 deleted, so that the character typed comes immediately after the
163 parameter name. Completion in a brace expansion is affected
164 similarly: the added character is a `,', which will be removed
165 if `}' is typed next.
166
167 AUTO_PARAM_SLASH <D>
168 If a parameter is completed whose content is the name of a di‐
169 rectory, then add a trailing slash instead of a space.
170
171 AUTO_REMOVE_SLASH <D>
172 When the last character resulting from a completion is a slash
173 and the next character typed is a word delimiter, a slash, or a
174 character that ends a command (such as a semicolon or an amper‐
175 sand), remove the slash.
176
177 BASH_AUTO_LIST
178 On an ambiguous completion, automatically list choices when the
179 completion function is called twice in succession. This takes
180 precedence over AUTO_LIST. The setting of LIST_AMBIGUOUS is re‐
181 spected. If AUTO_MENU is set, the menu behaviour will then
182 start with the third press. Note that this will not work with
183 MENU_COMPLETE, since repeated completion calls immediately cycle
184 through the list in that case.
185
186 COMPLETE_ALIASES
187 Prevents aliases on the command line from being internally sub‐
188 stituted before completion is attempted. The effect is to make
189 the alias a distinct command for completion purposes.
190
191 COMPLETE_IN_WORD
192 If unset, the cursor is set to the end of the word if completion
193 is started. Otherwise it stays there and completion is done from
194 both ends.
195
196 GLOB_COMPLETE
197 When the current word has a glob pattern, do not insert all the
198 words resulting from the expansion but generate matches as for
199 completion and cycle through them like MENU_COMPLETE. The
200 matches are generated as if a `*' was added to the end of the
201 word, or inserted at the cursor when COMPLETE_IN_WORD is set.
202 This actually uses pattern matching, not globbing, so it works
203 not only for files but for any completion, such as options, user
204 names, etc.
205
206 Note that when the pattern matcher is used, matching control
207 (for example, case-insensitive or anchored matching) cannot be
208 used. This limitation only applies when the current word con‐
209 tains a pattern; simply turning on the GLOB_COMPLETE option does
210 not have this effect.
211
212 HASH_LIST_ALL <D>
213 Whenever a command completion or spelling correction is at‐
214 tempted, make sure the entire command path is hashed first.
215 This makes the first completion slower but avoids false reports
216 of spelling errors.
217
218 LIST_AMBIGUOUS <D>
219 This option works when AUTO_LIST or BASH_AUTO_LIST is also set.
220 If there is an unambiguous prefix to insert on the command line,
221 that is done without a completion list being displayed; in other
222 words, auto-listing behaviour only takes place when nothing
223 would be inserted. In the case of BASH_AUTO_LIST, this means
224 that the list will be delayed to the third call of the function.
225
226 LIST_BEEP <D>
227 Beep on an ambiguous completion. More accurately, this forces
228 the completion widgets to return status 1 on an ambiguous com‐
229 pletion, which causes the shell to beep if the option BEEP is
230 also set; this may be modified if completion is called from a
231 user-defined widget.
232
233 LIST_PACKED
234 Try to make the completion list smaller (occupying less lines)
235 by printing the matches in columns with different widths.
236
237 LIST_ROWS_FIRST
238 Lay out the matches in completion lists sorted horizontally,
239 that is, the second match is to the right of the first one, not
240 under it as usual.
241
242 LIST_TYPES (-X) <D>
243 When listing files that are possible completions, show the type
244 of each file with a trailing identifying mark.
245
246 MENU_COMPLETE (-Y)
247 On an ambiguous completion, instead of listing possibilities or
248 beeping, insert the first match immediately. Then when comple‐
249 tion is requested again, remove the first match and insert the
250 second match, etc. When there are no more matches, go back to
251 the first one again. reverse-menu-complete may be used to loop
252 through the list in the other direction. This option overrides
253 AUTO_MENU.
254
255 REC_EXACT (-S)
256 If the string on the command line exactly matches one of the
257 possible completions, it is accepted, even if there is another
258 completion (i.e. that string with something else added) that
259 also matches.
260
261 Expansion and Globbing
262 BAD_PATTERN (+2) <C> <Z>
263 If a pattern for filename generation is badly formed, print an
264 error message. (If this option is unset, the pattern will be
265 left unchanged.)
266
267 BARE_GLOB_QUAL <Z>
268 In a glob pattern, treat a trailing set of parentheses as a
269 qualifier list, if it contains no `|', `(' or (if special) `~'
270 characters. See the section `Filename Generation'.
271
272 BRACE_CCL
273 Expand expressions in braces which would not otherwise undergo
274 brace expansion to a lexically ordered list of all the charac‐
275 ters. See the section `Brace Expansion'.
276
277 CASE_GLOB <D>
278 Make globbing (filename generation) sensitive to case. Note
279 that other uses of patterns are always sensitive to case. If
280 the option is unset, the presence of any character which is spe‐
281 cial to filename generation will cause case-insensitive match‐
282 ing. For example, cvs(/) can match the directory CVS owing to
283 the presence of the globbing flag (unless the option
284 BARE_GLOB_QUAL is unset).
285
286 CASE_MATCH <D>
287 Make regular expressions using the zsh/regex module (including
288 matches with =~) sensitive to case.
289
290 CSH_NULL_GLOB <C>
291 If a pattern for filename generation has no matches, delete the
292 pattern from the argument list; do not report an error unless
293 all the patterns in a command have no matches. Overrides NO‐
294 MATCH.
295
296 EQUALS <Z>
297 Perform = filename expansion. (See the section `Filename Expan‐
298 sion'.)
299
300 EXTENDED_GLOB
301 Treat the `#', `~' and `^' characters as part of patterns for
302 filename generation, etc. (An initial unquoted `~' always pro‐
303 duces named directory expansion.)
304
305 FORCE_FLOAT
306 Constants in arithmetic evaluation will be treated as floating
307 point even without the use of a decimal point; the values of in‐
308 teger variables will be converted to floating point when used in
309 arithmetic expressions. Integers in any base will be converted.
310
311 GLOB (+F, ksh: +f) <D>
312 Perform filename generation (globbing). (See the section `File‐
313 name Generation'.)
314
315 GLOB_ASSIGN <C>
316 If this option is set, filename generation (globbing) is per‐
317 formed on the right hand side of scalar parameter assignments of
318 the form `name=pattern (e.g. `foo=*'). If the result has more
319 than one word the parameter will become an array with those
320 words as arguments. This option is provided for backwards com‐
321 patibility only: globbing is always performed on the right hand
322 side of array assignments of the form `name=(value)' (e.g.
323 `foo=(*)') and this form is recommended for clarity; with this
324 option set, it is not possible to predict whether the result
325 will be an array or a scalar.
326
327 GLOB_DOTS (-4)
328 Do not require a leading `.' in a filename to be matched explic‐
329 itly.
330
331 GLOB_STAR_SHORT
332 When this option is set and the default zsh-style globbing is in
333 effect, the pattern `**/*' can be abbreviated to `**' and the
334 pattern `***/*' can be abbreviated to ***. Hence `**.c' finds a
335 file ending in .c in any subdirectory, and `***.c' does the same
336 while also following symbolic links. A / immediately after the
337 `**' or `***' forces the pattern to be treated as the unabbrevi‐
338 ated form.
339
340 GLOB_SUBST <C> <K> <S>
341 Treat any characters resulting from parameter expansion as being
342 eligible for filename expansion and filename generation, and any
343 characters resulting from command substitution as being eligible
344 for filename generation. Braces (and commas in between) do not
345 become eligible for expansion.
346
347 HIST_SUBST_PATTERN
348 Substitutions using the :s and :& history modifiers are per‐
349 formed with pattern matching instead of string matching. This
350 occurs wherever history modifiers are valid, including glob
351 qualifiers and parameters. See the section Modifiers in zsh‐
352 expn(1).
353
354 IGNORE_BRACES (-I) <S>
355 Do not perform brace expansion. For historical reasons this
356 also includes the effect of the IGNORE_CLOSE_BRACES option.
357
358 IGNORE_CLOSE_BRACES
359 When neither this option nor IGNORE_BRACES is set, a sole close
360 brace character `}' is syntactically significant at any point on
361 a command line. This has the effect that no semicolon or new‐
362 line is necessary before the brace terminating a function or
363 current shell construct. When either option is set, a closing
364 brace is syntactically significant only in command position.
365 Unlike IGNORE_BRACES, this option does not disable brace expan‐
366 sion.
367
368 For example, with both options unset a function may be defined
369 in the following fashion:
370
371 args() { echo $# }
372
373 while if either option is set, this does not work and something
374 equivalent to the following is required:
375
376 args() { echo $#; }
377
378 KSH_GLOB <K>
379 In pattern matching, the interpretation of parentheses is af‐
380 fected by a preceding `@', `*', `+', `?' or `!'. See the sec‐
381 tion `Filename Generation'.
382
383 MAGIC_EQUAL_SUBST
384 All unquoted arguments of the form `anything=expression' appear‐
385 ing after the command name have filename expansion (that is,
386 where expression has a leading `~' or `=') performed on expres‐
387 sion as if it were a parameter assignment. The argument is not
388 otherwise treated specially; it is passed to the command as a
389 single argument, and not used as an actual parameter assignment.
390 For example, in echo foo=~/bar:~/rod, both occurrences of ~
391 would be replaced. Note that this happens anyway with typeset
392 and similar statements.
393
394 This option respects the setting of the KSH_TYPESET option. In
395 other words, if both options are in effect, arguments looking
396 like assignments will not undergo word splitting.
397
398 MARK_DIRS (-8, ksh: -X)
399 Append a trailing `/' to all directory names resulting from
400 filename generation (globbing).
401
402 MULTIBYTE <D>
403 Respect multibyte characters when found in strings. When this
404 option is set, strings are examined using the system library to
405 determine how many bytes form a character, depending on the cur‐
406 rent locale. This affects the way characters are counted in
407 pattern matching, parameter values and various delimiters.
408
409 The option is on by default if the shell was compiled with
410 MULTIBYTE_SUPPORT; otherwise it is off by default and has no ef‐
411 fect if turned on.
412
413 If the option is off a single byte is always treated as a single
414 character. This setting is designed purely for examining
415 strings known to contain raw bytes or other values that may not
416 be characters in the current locale. It is not necessary to un‐
417 set the option merely because the character set for the current
418 locale does not contain multibyte characters.
419
420 The option does not affect the shell's editor, which always
421 uses the locale to determine multibyte characters. This is be‐
422 cause the character set displayed by the terminal emulator is
423 independent of shell settings.
424
425 NOMATCH (+3) <C> <Z>
426 If a pattern for filename generation has no matches, print an
427 error, instead of leaving it unchanged in the argument list.
428 This also applies to file expansion of an initial `~' or `='.
429
430 NULL_GLOB (-G)
431 If a pattern for filename generation has no matches, delete the
432 pattern from the argument list instead of reporting an error.
433 Overrides NOMATCH.
434
435 NUMERIC_GLOB_SORT
436 If numeric filenames are matched by a filename generation pat‐
437 tern, sort the filenames numerically rather than lexicographi‐
438 cally.
439
440 RC_EXPAND_PARAM (-P)
441 Array expansions of the form `foo${xx}bar', where the parameter
442 xx is set to (a b c), are substituted with `fooabar foobbar
443 foocbar' instead of the default `fooa b cbar'. Note that an
444 empty array will therefore cause all arguments to be removed.
445
446 REMATCH_PCRE
447 If set, regular expression matching with the =~ operator will
448 use Perl-Compatible Regular Expressions from the PCRE library.
449 (The zsh/pcre module must be available.) If not set, regular
450 expressions will use the extended regexp syntax provided by the
451 system libraries.
452
453 SH_GLOB <K> <S>
454 Disables the special meaning of `(', `|', `)' and '<' for glob‐
455 bing the result of parameter and command substitutions, and in
456 some other places where the shell accepts patterns. If SH_GLOB
457 is set but KSH_GLOB is not, the shell allows the interpretation
458 of subshell expressions enclosed in parentheses in some cases
459 where there is no space before the opening parenthesis, e.g.
460 !(true) is interpreted as if there were a space after the !.
461 This option is set by default if zsh is invoked as sh or ksh.
462
463 UNSET (+u, ksh: +u) <K> <S> <Z>
464 Treat unset parameters as if they were empty when substituting,
465 and as if they were zero when reading their values in arithmetic
466 expansion and arithmetic commands. Otherwise they are treated
467 as an error.
468
469 WARN_CREATE_GLOBAL
470 Print a warning message when a global parameter is created in a
471 function by an assignment or in math context. This often indi‐
472 cates that a parameter has not been declared local when it
473 should have been. Parameters explicitly declared global from
474 within a function using typeset -g do not cause a warning. Note
475 that there is no warning when a local parameter is assigned to
476 in a nested function, which may also indicate an error.
477
478 WARN_NESTED_VAR
479 Print a warning message when an existing parameter from an en‐
480 closing function scope, or global, is set in a function by an
481 assignment or in math context. Assignment to shell special pa‐
482 rameters does not cause a warning. This is the companion to
483 WARN_CREATE_GLOBAL as in this case the warning is only printed
484 when a parameter is not created. Where possible, use of typeset
485 -g to set the parameter suppresses the error, but note that this
486 needs to be used every time the parameter is set. To restrict
487 the effect of this option to a single function scope, use `func‐
488 tions -W'.
489
490 For example, the following code produces a warning for the as‐
491 signment inside the function nested as that overrides the value
492 within toplevel
493
494 toplevel() {
495 local foo="in fn"
496 nested
497 }
498 nested() {
499 foo="in nested"
500 }
501 setopt warn_nested_var
502 toplevel
503
504 History
505 APPEND_HISTORY <D>
506 If this is set, zsh sessions will append their history list to
507 the history file, rather than replace it. Thus, multiple paral‐
508 lel zsh sessions will all have the new entries from their his‐
509 tory lists added to the history file, in the order that they
510 exit. The file will still be periodically re-written to trim it
511 when the number of lines grows 20% beyond the value specified by
512 $SAVEHIST (see also the HIST_SAVE_BY_COPY option).
513
514 BANG_HIST (+K) <C> <Z>
515 Perform textual history expansion, csh-style, treating the char‐
516 acter `!' specially.
517
518 EXTENDED_HISTORY <C>
519 Save each command's beginning timestamp (in seconds since the
520 epoch) and the duration (in seconds) to the history file. The
521 format of this prefixed data is:
522
523 `: <beginning time>:<elapsed seconds>;<command>'.
524
525 HIST_ALLOW_CLOBBER
526 Add `|' to output redirections in the history. This allows his‐
527 tory references to clobber files even when CLOBBER is unset.
528
529 HIST_BEEP <D>
530 Beep in ZLE when a widget attempts to access a history entry
531 which isn't there.
532
533 HIST_EXPIRE_DUPS_FIRST
534 If the internal history needs to be trimmed to add the current
535 command line, setting this option will cause the oldest history
536 event that has a duplicate to be lost before losing a unique
537 event from the list. You should be sure to set the value of
538 HISTSIZE to a larger number than SAVEHIST in order to give you
539 some room for the duplicated events, otherwise this option will
540 behave just like HIST_IGNORE_ALL_DUPS once the history fills up
541 with unique events.
542
543 HIST_FCNTL_LOCK
544 When writing out the history file, by default zsh uses ad-hoc
545 file locking to avoid known problems with locking on some oper‐
546 ating systems. With this option locking is done by means of the
547 system's fcntl call, where this method is available. On recent
548 operating systems this may provide better performance, in par‐
549 ticular avoiding history corruption when files are stored on
550 NFS.
551
552 HIST_FIND_NO_DUPS
553 When searching for history entries in the line editor, do not
554 display duplicates of a line previously found, even if the du‐
555 plicates are not contiguous.
556
557 HIST_IGNORE_ALL_DUPS
558 If a new command line being added to the history list duplicates
559 an older one, the older command is removed from the list (even
560 if it is not the previous event).
561
562 HIST_IGNORE_DUPS (-h)
563 Do not enter command lines into the history list if they are du‐
564 plicates of the previous event.
565
566 HIST_IGNORE_SPACE (-g)
567 Remove command lines from the history list when the first char‐
568 acter on the line is a space, or when one of the expanded
569 aliases contains a leading space. Only normal aliases (not
570 global or suffix aliases) have this behaviour. Note that the
571 command lingers in the internal history until the next command
572 is entered before it vanishes, allowing you to briefly reuse or
573 edit the line. If you want to make it vanish right away without
574 entering another command, type a space and press return.
575
576 HIST_LEX_WORDS
577 By default, shell history that is read in from files is split
578 into words on all white space. This means that arguments with
579 quoted whitespace are not correctly handled, with the conse‐
580 quence that references to words in history lines that have been
581 read from a file may be inaccurate. When this option is set,
582 words read in from a history file are divided up in a similar
583 fashion to normal shell command line handling. Although this
584 produces more accurately delimited words, if the size of the
585 history file is large this can be slow. Trial and error is nec‐
586 essary to decide.
587
588 HIST_NO_FUNCTIONS
589 Remove function definitions from the history list. Note that
590 the function lingers in the internal history until the next com‐
591 mand is entered before it vanishes, allowing you to briefly re‐
592 use or edit the definition.
593
594 HIST_NO_STORE
595 Remove the history (fc -l) command from the history list when
596 invoked. Note that the command lingers in the internal history
597 until the next command is entered before it vanishes, allowing
598 you to briefly reuse or edit the line.
599
600 HIST_REDUCE_BLANKS
601 Remove superfluous blanks from each command line being added to
602 the history list.
603
604 HIST_SAVE_BY_COPY <D>
605 When the history file is re-written, we normally write out a
606 copy of the file named $HISTFILE.new and then rename it over the
607 old one. However, if this option is unset, we instead truncate
608 the old history file and write out the new version in-place. If
609 one of the history-appending options is enabled, this option
610 only has an effect when the enlarged history file needs to be
611 re-written to trim it down to size. Disable this only if you
612 have special needs, as doing so makes it possible to lose his‐
613 tory entries if zsh gets interrupted during the save.
614
615 When writing out a copy of the history file, zsh preserves the
616 old file's permissions and group information, but will refuse to
617 write out a new file if it would change the history file's
618 owner.
619
620 HIST_SAVE_NO_DUPS
621 When writing out the history file, older commands that duplicate
622 newer ones are omitted.
623
624 HIST_VERIFY
625 Whenever the user enters a line with history expansion, don't
626 execute the line directly; instead, perform history expansion
627 and reload the line into the editing buffer.
628
629 INC_APPEND_HISTORY
630 This option works like APPEND_HISTORY except that new history
631 lines are added to the $HISTFILE incrementally (as soon as they
632 are entered), rather than waiting until the shell exits. The
633 file will still be periodically re-written to trim it when the
634 number of lines grows 20% beyond the value specified by $SAVE‐
635 HIST (see also the HIST_SAVE_BY_COPY option).
636
637 INC_APPEND_HISTORY_TIME
638 This option is a variant of INC_APPEND_HISTORY in which, where
639 possible, the history entry is written out to the file after the
640 command is finished, so that the time taken by the command is
641 recorded correctly in the history file in EXTENDED_HISTORY for‐
642 mat. This means that the history entry will not be available
643 immediately from other instances of the shell that are using the
644 same history file.
645
646 This option is only useful if INC_APPEND_HISTORY and SHARE_HIS‐
647 TORY are turned off. The three options should be considered mu‐
648 tually exclusive.
649
650 SHARE_HISTORY <K>
651
652 This option both imports new commands from the history file, and
653 also causes your typed commands to be appended to the history
654 file (the latter is like specifying INC_APPEND_HISTORY, which
655 should be turned off if this option is in effect). The history
656 lines are also output with timestamps ala EXTENDED_HISTORY
657 (which makes it easier to find the spot where we left off read‐
658 ing the file after it gets re-written).
659
660 By default, history movement commands visit the imported lines
661 as well as the local lines, but you can toggle this on and off
662 with the set-local-history zle binding. It is also possible to
663 create a zle widget that will make some commands ignore imported
664 commands, and some include them.
665
666 If you find that you want more control over when commands get
667 imported, you may wish to turn SHARE_HISTORY off, INC_AP‐
668 PEND_HISTORY or INC_APPEND_HISTORY_TIME (see above) on, and then
669 manually import commands whenever you need them using `fc -RI'.
670
671 Initialisation
672 ALL_EXPORT (-a, ksh: -a)
673 All parameters subsequently defined are automatically exported.
674
675 GLOBAL_EXPORT <Z>
676 If this option is set, passing the -x flag to the builtins de‐
677 clare, float, integer, readonly and typeset (but not local) will
678 also set the -g flag; hence parameters exported to the environ‐
679 ment will not be made local to the enclosing function, unless
680 they were already or the flag +g is given explicitly. If the
681 option is unset, exported parameters will be made local in just
682 the same way as any other parameter.
683
684 This option is set by default for backward compatibility; it is
685 not recommended that its behaviour be relied upon. Note that
686 the builtin export always sets both the -x and -g flags, and
687 hence its effect extends beyond the scope of the enclosing func‐
688 tion; this is the most portable way to achieve this behaviour.
689
690 GLOBAL_RCS (-d) <D>
691 If this option is unset, the startup files /etc/zprofile,
692 /etc/zshrc, /etc/zlogin and /etc/zlogout will not be run. It
693 can be disabled and re-enabled at any time, including inside lo‐
694 cal startup files (.zshrc, etc.).
695
696 RCS (+f) <D>
697 After /etc/zshenv is sourced on startup, source the .zshenv,
698 /etc/zprofile, .zprofile, /etc/zshrc, .zshrc, /etc/zlogin, .zlo‐
699 gin, and .zlogout files, as described in the section `Files'.
700 If this option is unset, the /etc/zshenv file is still sourced,
701 but any of the others will not be; it can be set at any time to
702 prevent the remaining startup files after the currently execut‐
703 ing one from being sourced.
704
705 Input/Output
706 ALIASES <D>
707 Expand aliases.
708
709 CLOBBER (+C, ksh: +C) <D>
710 Allows `>' redirection to truncate existing files. Otherwise
711 `>!' or `>|' must be used to truncate a file.
712
713 If the option is not set, and the option APPEND_CREATE is also
714 not set, `>>!' or `>>|' must be used to create a file. If ei‐
715 ther option is set, `>>' may be used.
716
717 CORRECT (-0)
718 Try to correct the spelling of commands. Note that, when the
719 HASH_LIST_ALL option is not set or when some directories in the
720 path are not readable, this may falsely report spelling errors
721 the first time some commands are used.
722
723 The shell variable CORRECT_IGNORE may be set to a pattern to
724 match words that will never be offered as corrections.
725
726 CORRECT_ALL (-O)
727 Try to correct the spelling of all arguments in a line.
728
729 The shell variable CORRECT_IGNORE_FILE may be set to a pattern
730 to match file names that will never be offered as corrections.
731
732 DVORAK Use the Dvorak keyboard instead of the standard qwerty keyboard
733 as a basis for examining spelling mistakes for the CORRECT and
734 CORRECT_ALL options and the spell-word editor command.
735
736 FLOW_CONTROL <D>
737 If this option is unset, output flow control via start/stop
738 characters (usually assigned to ^S/^Q) is disabled in the
739 shell's editor.
740
741 IGNORE_EOF (-7)
742 Do not exit on end-of-file. Require the use of exit or logout
743 instead. However, ten consecutive EOFs will cause the shell to
744 exit anyway, to avoid the shell hanging if its tty goes away.
745
746 Also, if this option is set and the Zsh Line Editor is used,
747 widgets implemented by shell functions can be bound to EOF (nor‐
748 mally Control-D) without printing the normal warning message.
749 This works only for normal widgets, not for completion widgets.
750
751 INTERACTIVE_COMMENTS (-k) <K> <S>
752 Allow comments even in interactive shells.
753
754 HASH_CMDS <D>
755 Note the location of each command the first time it is executed.
756 Subsequent invocations of the same command will use the saved
757 location, avoiding a path search. If this option is unset, no
758 path hashing is done at all. However, when CORRECT is set, com‐
759 mands whose names do not appear in the functions or aliases hash
760 tables are hashed in order to avoid reporting them as spelling
761 errors.
762
763 HASH_DIRS <D>
764 Whenever a command name is hashed, hash the directory containing
765 it, as well as all directories that occur earlier in the path.
766 Has no effect if neither HASH_CMDS nor CORRECT is set.
767
768 HASH_EXECUTABLES_ONLY
769 When hashing commands because of HASH_CMDS, check that the file
770 to be hashed is actually an executable. This option is unset by
771 default as if the path contains a large number of commands, or
772 consists of many remote files, the additional tests can take a
773 long time. Trial and error is needed to show if this option is
774 beneficial.
775
776 MAIL_WARNING (-U)
777 Print a warning message if a mail file has been accessed since
778 the shell last checked.
779
780 PATH_DIRS (-Q)
781 Perform a path search even on command names with slashes in
782 them. Thus if `/usr/local/bin' is in the user's path, and he or
783 she types `X11/xinit', the command `/usr/local/bin/X11/xinit'
784 will be executed (assuming it exists). Commands explicitly be‐
785 ginning with `/', `./' or `../' are not subject to the path
786 search. This also applies to the `.' and source builtins.
787
788 Note that subdirectories of the current directory are always
789 searched for executables specified in this form. This takes
790 place before any search indicated by this option, and regardless
791 of whether `.' or the current directory appear in the command
792 search path.
793
794 PATH_SCRIPT <K> <S>
795 If this option is not set, a script passed as the first non-op‐
796 tion argument to the shell must contain the name of the file to
797 open. If this option is set, and the script does not specify a
798 directory path, the script is looked for first in the current
799 directory, then in the command path. See the section INVOCATION
800 in zsh(1).
801
802 PRINT_EIGHT_BIT
803 Print eight bit characters literally in completion lists, etc.
804 This option is not necessary if your system correctly returns
805 the printability of eight bit characters (see ctype(3)).
806
807 PRINT_EXIT_VALUE (-1)
808 Print the exit value of programs with non-zero exit status.
809 This is only available at the command line in interactive
810 shells.
811
812 RC_QUOTES
813 Allow the character sequence `''' to signify a single quote
814 within singly quoted strings. Note this does not apply in
815 quoted strings using the format $'...', where a backslashed sin‐
816 gle quote can be used.
817
818 RM_STAR_SILENT (-H) <K> <S>
819 Do not query the user before executing `rm *' or `rm path/*'.
820
821 RM_STAR_WAIT
822 If querying the user before executing `rm *' or `rm path/*',
823 first wait ten seconds and ignore anything typed in that time.
824 This avoids the problem of reflexively answering `yes' to the
825 query when one didn't really mean it. The wait and query can
826 always be avoided by expanding the `*' in ZLE (with tab).
827
828 SHORT_LOOPS <C> <Z>
829 Allow the short forms of for, repeat, select, if, and function
830 constructs.
831
832 SUN_KEYBOARD_HACK (-L)
833 If a line ends with a backquote, and there are an odd number of
834 backquotes on the line, ignore the trailing backquote. This is
835 useful on some keyboards where the return key is too small, and
836 the backquote key lies annoyingly close to it. As an alterna‐
837 tive the variable KEYBOARD_HACK lets you choose the character to
838 be removed.
839
840 Job Control
841 AUTO_CONTINUE
842 With this option set, stopped jobs that are removed from the job
843 table with the disown builtin command are automatically sent a
844 CONT signal to make them running.
845
846 AUTO_RESUME (-W)
847 Treat single word simple commands without redirection as candi‐
848 dates for resumption of an existing job.
849
850 BG_NICE (-6) <C> <Z>
851 Run all background jobs at a lower priority. This option is set
852 by default.
853
854 CHECK_JOBS <Z>
855 Report the status of background and suspended jobs before exit‐
856 ing a shell with job control; a second attempt to exit the shell
857 will succeed. NO_CHECK_JOBS is best used only in combination
858 with NO_HUP, else such jobs will be killed automatically.
859
860 The check is omitted if the commands run from the previous com‐
861 mand line included a `jobs' command, since it is assumed the
862 user is aware that there are background or suspended jobs. A
863 `jobs' command run from one of the hook functions defined in the
864 section SPECIAL FUNCTIONS in zshmisc(1) is not counted for this
865 purpose.
866
867 CHECK_RUNNING_JOBS <Z>
868 Check for both running and suspended jobs when CHECK_JOBS is en‐
869 abled. When this option is disabled, zsh checks only for sus‐
870 pended jobs, which matches the default behavior of bash.
871
872 This option has no effect unless CHECK_JOBS is set.
873
874 HUP <Z>
875 Send the HUP signal to running jobs when the shell exits.
876
877 LONG_LIST_JOBS (-R)
878 Print job notifications in the long format by default.
879
880 MONITOR (-m, ksh: -m)
881 Allow job control. Set by default in interactive shells.
882
883 NOTIFY (-5, ksh: -b) <Z>
884 Report the status of background jobs immediately, rather than
885 waiting until just before printing a prompt.
886
887 POSIX_JOBS <K> <S>
888 This option makes job control more compliant with the POSIX
889 standard.
890
891 When the option is not set, the MONITOR option is unset on entry
892 to subshells, so that job control is no longer active. When the
893 option is set, the MONITOR option and job control remain active
894 in the subshell, but note that the subshell has no access to
895 jobs in the parent shell.
896
897 When the option is not set, jobs put in the background or fore‐
898 ground with bg or fg are displayed with the same information
899 that would be reported by jobs. When the option is set, only
900 the text is printed. The output from jobs itself is not af‐
901 fected by the option.
902
903 When the option is not set, job information from the parent
904 shell is saved for output within a subshell (for example, within
905 a pipeline). When the option is set, the output of jobs is
906 empty until a job is started within the subshell.
907
908 In previous versions of the shell, it was necessary to enable
909 POSIX_JOBS in order for the builtin command wait to return the
910 status of background jobs that had already exited. This is no
911 longer the case.
912
913 Prompting
914 PROMPT_BANG <K>
915 If set, `!' is treated specially in prompt expansion. See EX‐
916 PANSION OF PROMPT SEQUENCES in zshmisc(1).
917
918 PROMPT_CR (+V) <D>
919 Print a carriage return just before printing a prompt in the
920 line editor. This is on by default as multi-line editing is
921 only possible if the editor knows where the start of the line
922 appears.
923
924 PROMPT_SP <D>
925 Attempt to preserve a partial line (i.e. a line that did not end
926 with a newline) that would otherwise be covered up by the com‐
927 mand prompt due to the PROMPT_CR option. This works by out‐
928 putting some cursor-control characters, including a series of
929 spaces, that should make the terminal wrap to the next line when
930 a partial line is present (note that this is only successful if
931 your terminal has automatic margins, which is typical).
932
933 When a partial line is preserved, by default you will see an in‐
934 verse+bold character at the end of the partial line: a `%' for
935 a normal user or a `#' for root. If set, the shell parameter
936 PROMPT_EOL_MARK can be used to customize how the end of partial
937 lines are shown.
938
939 NOTE: if the PROMPT_CR option is not set, enabling this option
940 will have no effect. This option is on by default.
941
942 PROMPT_PERCENT <C> <Z>
943 If set, `%' is treated specially in prompt expansion. See EX‐
944 PANSION OF PROMPT SEQUENCES in zshmisc(1).
945
946 PROMPT_SUBST <K> <S>
947 If set, parameter expansion, command substitution and arithmetic
948 expansion are performed in prompts. Substitutions within
949 prompts do not affect the command status.
950
951 TRANSIENT_RPROMPT
952 Remove any right prompt from display when accepting a command
953 line. This may be useful with terminals with other cut/paste
954 methods.
955
956 Scripts and Functions
957 ALIAS_FUNC_DEF <S>
958 By default, zsh does not allow the definition of functions using
959 the `name ()' syntax if name was expanded as an alias: this
960 causes an error. This is usually the desired behaviour, as oth‐
961 erwise the combination of an alias and a function based on the
962 same definition can easily cause problems.
963
964 When this option is set, aliases can be used for defining func‐
965 tions.
966
967 For example, consider the following definitions as they might
968 occur in a startup file.
969
970 alias foo=bar
971 foo() {
972 print This probably does not do what you expect.
973 }
974
975 Here, foo is expanded as an alias to bar before the () is en‐
976 countered, so the function defined would be named bar. By de‐
977 fault this is instead an error in native mode. Note that quot‐
978 ing any part of the function name, or using the keyword func‐
979 tion, avoids the problem, so is recommended when the function
980 name can also be an alias.
981
982 C_BASES
983 Output hexadecimal numbers in the standard C format, for example
984 `0xFF' instead of the usual `16#FF'. If the option OCTAL_ZEROES
985 is also set (it is not by default), octal numbers will be
986 treated similarly and hence appear as `077' instead of `8#77'.
987 This option has no effect on the choice of the output base, nor
988 on the output of bases other than hexadecimal and octal. Note
989 that these formats will be understood on input irrespective of
990 the setting of C_BASES.
991
992 C_PRECEDENCES
993 This alters the precedence of arithmetic operators to be more
994 like C and other programming languages; the section ARITHMETIC
995 EVALUATION in zshmisc(1) has an explicit list.
996
997 DEBUG_BEFORE_CMD <D>
998 Run the DEBUG trap before each command; otherwise it is run af‐
999 ter each command. Setting this option mimics the behaviour of
1000 ksh 93; with the option unset the behaviour is that of ksh 88.
1001
1002 ERR_EXIT (-e, ksh: -e)
1003 If a command has a non-zero exit status, execute the ZERR trap,
1004 if set, and exit. This is disabled while running initialization
1005 scripts.
1006
1007 The behaviour is also disabled inside DEBUG traps. In this case
1008 the option is handled specially: it is unset on entry to the
1009 trap. If the option DEBUG_BEFORE_CMD is set, as it is by de‐
1010 fault, and the option ERR_EXIT is found to have been set on
1011 exit, then the command for which the DEBUG trap is being exe‐
1012 cuted is skipped. The option is restored after the trap exits.
1013
1014 Non-zero status in a command list containing && or || is ignored
1015 for commands not at the end of the list. Hence
1016
1017 false && true
1018
1019 does not trigger exit.
1020
1021 Exiting due to ERR_EXIT has certain interactions with asynchro‐
1022 nous jobs noted in the section JOBS in zshmisc(1).
1023
1024 ERR_RETURN
1025 If a command has a non-zero exit status, return immediately from
1026 the enclosing function. The logic is similar to that for
1027 ERR_EXIT, except that an implicit return statement is executed
1028 instead of an exit. This will trigger an exit at the outermost
1029 level of a non-interactive script.
1030
1031 Normally this option inherits the behaviour of ERR_EXIT that
1032 code followed by `&&' `||' does not trigger a return. Hence in
1033 the following:
1034
1035 summit || true
1036
1037 no return is forced as the combined effect always has a zero re‐
1038 turn status.
1039
1040 Note. however, that if summit in the above example is itself a
1041 function, code inside it is considered separately: it may force
1042 a return from summit (assuming the option remains set within
1043 summit), but not from the enclosing context. This behaviour is
1044 different from ERR_EXIT which is unaffected by function scope.
1045
1046 EVAL_LINENO <Z>
1047 If set, line numbers of expressions evaluated using the builtin
1048 eval are tracked separately of the enclosing environment. This
1049 applies both to the parameter LINENO and the line number output
1050 by the prompt escape %i. If the option is set, the prompt es‐
1051 cape %N will output the string `(eval)' instead of the script or
1052 function name as an indication. (The two prompt escapes are
1053 typically used in the parameter PS4 to be output when the option
1054 XTRACE is set.) If EVAL_LINENO is unset, the line number of the
1055 surrounding script or function is retained during the evalua‐
1056 tion.
1057
1058 EXEC (+n, ksh: +n) <D>
1059 Do execute commands. Without this option, commands are read and
1060 checked for syntax errors, but not executed. This option cannot
1061 be turned off in an interactive shell, except when `-n' is sup‐
1062 plied to the shell at startup.
1063
1064 FUNCTION_ARGZERO <C> <Z>
1065 When executing a shell function or sourcing a script, set $0
1066 temporarily to the name of the function/script. Note that tog‐
1067 gling FUNCTION_ARGZERO from on to off (or off to on) does not
1068 change the current value of $0. Only the state upon entry to
1069 the function or script has an effect. Compare POSIX_ARGZERO.
1070
1071 LOCAL_LOOPS
1072 When this option is not set, the effect of break and continue
1073 commands may propagate outside function scope, affecting loops
1074 in calling functions. When the option is set in a calling func‐
1075 tion, a break or a continue that is not caught within a called
1076 function (regardless of the setting of the option within that
1077 function) produces a warning and the effect is cancelled.
1078
1079 LOCAL_OPTIONS <K>
1080 If this option is set at the point of return from a shell func‐
1081 tion, most options (including this one) which were in force upon
1082 entry to the function are restored; options that are not re‐
1083 stored are PRIVILEGED and RESTRICTED. Otherwise, only this op‐
1084 tion, and the LOCAL_LOOPS, XTRACE and PRINT_EXIT_VALUE options
1085 are restored. Hence if this is explicitly unset by a shell
1086 function the other options in force at the point of return will
1087 remain so. A shell function can also guarantee itself a known
1088 shell configuration with a formulation like `emulate -L zsh';
1089 the -L activates LOCAL_OPTIONS.
1090
1091 LOCAL_PATTERNS
1092 If this option is set at the point of return from a shell func‐
1093 tion, the state of pattern disables, as set with the builtin
1094 command `disable -p', is restored to what it was when the func‐
1095 tion was entered. The behaviour of this option is similar to
1096 the effect of LOCAL_OPTIONS on options; hence `emulate -L sh'
1097 (or indeed any other emulation with the -L option) activates LO‐
1098 CAL_PATTERNS.
1099
1100 LOCAL_TRAPS <K>
1101 If this option is set when a signal trap is set inside a func‐
1102 tion, then the previous status of the trap for that signal will
1103 be restored when the function exits. Note that this option must
1104 be set prior to altering the trap behaviour in a function; un‐
1105 like LOCAL_OPTIONS, the value on exit from the function is ir‐
1106 relevant. However, it does not need to be set before any global
1107 trap for that to be correctly restored by a function. For exam‐
1108 ple,
1109
1110 unsetopt localtraps
1111 trap - INT
1112 fn() { setopt localtraps; trap '' INT; sleep 3; }
1113
1114 will restore normal handling of SIGINT after the function exits.
1115
1116 MULTI_FUNC_DEF <Z>
1117 Allow definitions of multiple functions at once in the form `fn1
1118 fn2...()'; if the option is not set, this causes a parse error.
1119 Definition of multiple functions with the function keyword is
1120 always allowed. Multiple function definitions are not often
1121 used and can cause obscure errors.
1122
1123 MULTIOS <Z>
1124 Perform implicit tees or cats when multiple redirections are at‐
1125 tempted (see the section `Redirection').
1126
1127 OCTAL_ZEROES <S>
1128 Interpret any integer constant beginning with a 0 as octal, per
1129 IEEE Std 1003.2-1992 (ISO 9945-2:1993). This is not enabled by
1130 default as it causes problems with parsing of, for example, date
1131 and time strings with leading zeroes.
1132
1133 Sequences of digits indicating a numeric base such as the `08'
1134 component in `08#77' are always interpreted as decimal, regard‐
1135 less of leading zeroes.
1136
1137 PIPE_FAIL
1138 By default, when a pipeline exits the exit status recorded by
1139 the shell and returned by the shell variable $? reflects that of
1140 the rightmost element of a pipeline. If this option is set, the
1141 exit status instead reflects the status of the rightmost element
1142 of the pipeline that was non-zero, or zero if all elements ex‐
1143 ited with zero status.
1144
1145 SOURCE_TRACE
1146 If set, zsh will print an informational message announcing the
1147 name of each file it loads. The format of the output is similar
1148 to that for the XTRACE option, with the message <sourcetrace>.
1149 A file may be loaded by the shell itself when it starts up and
1150 shuts down (Startup/Shutdown Files) or by the use of the
1151 `source' and `dot' builtin commands.
1152
1153 TYPESET_SILENT
1154 If this is unset, executing any of the `typeset' family of com‐
1155 mands with no options and a list of parameters that have no val‐
1156 ues to be assigned but already exist will display the value of
1157 the parameter. If the option is set, they will only be shown
1158 when parameters are selected with the `-m' option. The option
1159 `-p' is available whether or not the option is set.
1160
1161 VERBOSE (-v, ksh: -v)
1162 Print shell input lines as they are read.
1163
1164 XTRACE (-x, ksh: -x)
1165 Print commands and their arguments as they are executed. The
1166 output is preceded by the value of $PS4, formatted as described
1167 in the section EXPANSION OF PROMPT SEQUENCES in zshmisc(1).
1168
1169 Shell Emulation
1170 APPEND_CREATE <K> <S>
1171 This option only applies when NO_CLOBBER (-C) is in effect.
1172
1173 If this option is not set, the shell will report an error when a
1174 append redirection (>>) is used on a file that does not already
1175 exists (the traditional zsh behaviour of NO_CLOBBER). If the
1176 option is set, no error is reported (POSIX behaviour).
1177
1178 BASH_REMATCH
1179 When set, matches performed with the =~ operator will set the
1180 BASH_REMATCH array variable, instead of the default MATCH and
1181 match variables. The first element of the BASH_REMATCH array
1182 will contain the entire matched text and subsequent elements
1183 will contain extracted substrings. This option makes more sense
1184 when KSH_ARRAYS is also set, so that the entire matched portion
1185 is stored at index 0 and the first substring is at index 1.
1186 Without this option, the MATCH variable contains the entire
1187 matched text and the match array variable contains substrings.
1188
1189 BSD_ECHO <S>
1190 Make the echo builtin compatible with the BSD echo(1) command.
1191 This disables backslashed escape sequences in echo strings un‐
1192 less the -e option is specified.
1193
1194 CONTINUE_ON_ERROR
1195 If a fatal error is encountered (see the section ERRORS in zsh‐
1196 misc(1)), and the code is running in a script, the shell will
1197 resume execution at the next statement in the script at the top
1198 level, in other words outside all functions or shell constructs
1199 such as loops and conditions. This mimics the behaviour of in‐
1200 teractive shells, where the shell returns to the line editor to
1201 read a new command; it was the normal behaviour in versions of
1202 zsh before 5.0.1.
1203
1204 CSH_JUNKIE_HISTORY <C>
1205 A history reference without an event specifier will always refer
1206 to the previous command. Without this option, such a history
1207 reference refers to the same event as the previous history ref‐
1208 erence on the current command line, defaulting to the previous
1209 command.
1210
1211 CSH_JUNKIE_LOOPS <C>
1212 Allow loop bodies to take the form `list; end' instead of `do
1213 list; done'.
1214
1215 CSH_JUNKIE_QUOTES <C>
1216 Changes the rules for single- and double-quoted text to match
1217 that of csh. These require that embedded newlines be preceded
1218 by a backslash; unescaped newlines will cause an error message.
1219 In double-quoted strings, it is made impossible to escape `$',
1220 ``' or `"' (and `\' itself no longer needs escaping). Command
1221 substitutions are only expanded once, and cannot be nested.
1222
1223 CSH_NULLCMD <C>
1224 Do not use the values of NULLCMD and READNULLCMD when running
1225 redirections with no command. This make such redirections fail
1226 (see the section `Redirection').
1227
1228 KSH_ARRAYS <K> <S>
1229 Emulate ksh array handling as closely as possible. If this op‐
1230 tion is set, array elements are numbered from zero, an array pa‐
1231 rameter without subscript refers to the first element instead of
1232 the whole array, and braces are required to delimit a subscript
1233 (`${path[2]}' rather than just `$path[2]') or to apply modifiers
1234 to any parameter (`${PWD:h}' rather than `$PWD:h').
1235
1236 KSH_AUTOLOAD <K> <S>
1237 Emulate ksh function autoloading. This means that when a func‐
1238 tion is autoloaded, the corresponding file is merely executed,
1239 and must define the function itself. (By default, the function
1240 is defined to the contents of the file. However, the most com‐
1241 mon ksh-style case - of the file containing only a simple defi‐
1242 nition of the function - is always handled in the ksh-compatible
1243 manner.)
1244
1245 KSH_OPTION_PRINT <K>
1246 Alters the way options settings are printed: instead of separate
1247 lists of set and unset options, all options are shown, marked
1248 `on' if they are in the non-default state, `off' otherwise.
1249
1250 KSH_TYPESET
1251 This option is now obsolete: a better appropximation to the be‐
1252 haviour of other shells is obtained with the reserved word in‐
1253 terface to declare, export, float, integer, local, readonly and
1254 typeset. Note that the option is only applied when the reserved
1255 word interface is not in use.
1256
1257 Alters the way arguments to the typeset family of commands, in‐
1258 cluding declare, export, float, integer, local and readonly, are
1259 processed. Without this option, zsh will perform normal word
1260 splitting after command and parameter expansion in arguments of
1261 an assignment; with it, word splitting does not take place in
1262 those cases.
1263
1264 KSH_ZERO_SUBSCRIPT
1265 Treat use of a subscript of value zero in array or string ex‐
1266 pressions as a reference to the first element, i.e. the element
1267 that usually has the subscript 1. Ignored if KSH_ARRAYS is also
1268 set.
1269
1270 If neither this option nor KSH_ARRAYS is set, accesses to an el‐
1271 ement of an array or string with subscript zero return an empty
1272 element or string, while attempts to set element zero of an ar‐
1273 ray or string are treated as an error. However, attempts to set
1274 an otherwise valid subscript range that includes zero will suc‐
1275 ceed. For example, if KSH_ZERO_SUBSCRIPT is not set,
1276
1277 array[0]=(element)
1278
1279 is an error, while
1280
1281 array[0,1]=(element)
1282
1283 is not and will replace the first element of the array.
1284
1285 This option is for compatibility with older versions of the
1286 shell and is not recommended in new code.
1287
1288 POSIX_ALIASES <K> <S>
1289 When this option is set, reserved words are not candidates for
1290 alias expansion: it is still possible to declare any of them as
1291 an alias, but the alias will never be expanded. Reserved words
1292 are described in the section RESERVED WORDS in zshmisc(1).
1293
1294 Alias expansion takes place while text is being read; hence when
1295 this option is set it does not take effect until the end of any
1296 function or other piece of shell code parsed as one unit. Note
1297 this may cause differences from other shells even when the op‐
1298 tion is in effect. For example, when running a command with
1299 `zsh -c', or even `zsh -o posixaliases -c', the entire command
1300 argument is parsed as one unit, so aliases defined within the
1301 argument are not available even in later lines. If in doubt,
1302 avoid use of aliases in non-interactive code.
1303
1304 POSIX_ARGZERO
1305 This option may be used to temporarily disable FUNCTION_ARGZERO
1306 and thereby restore the value of $0 to the name used to invoke
1307 the shell (or as set by the -c command line option). For com‐
1308 patibility with previous versions of the shell, emulations use
1309 NO_FUNCTION_ARGZERO instead of POSIX_ARGZERO, which may result
1310 in unexpected scoping of $0 if the emulation mode is changed in‐
1311 side a function or script. To avoid this, explicitly enable
1312 POSIX_ARGZERO in the emulate command:
1313
1314 emulate sh -o POSIX_ARGZERO
1315
1316 Note that NO_POSIX_ARGZERO has no effect unless FUNCTION_ARGZERO
1317 was already enabled upon entry to the function or script.
1318
1319 POSIX_BUILTINS <K> <S>
1320 When this option is set the command builtin can be used to exe‐
1321 cute shell builtin commands. Parameter assignments specified
1322 before shell functions and special builtins are kept after the
1323 command completes unless the special builtin is prefixed with
1324 the command builtin. Special builtins are ., :, break, con‐
1325 tinue, declare, eval, exit, export, integer, local, readonly,
1326 return, set, shift, source, times, trap and unset.
1327
1328 In addition, various error conditions associated with the above
1329 builtins or exec cause a non-interactive shell to exit and an
1330 interactive shell to return to its top-level processing.
1331
1332 Furthermore, functions and shell builtins are not executed after
1333 an exec prefix; the command to be executed must be an external
1334 command found in the path.
1335
1336 Furthermore, the getopts builtin behaves in a POSIX-compatible
1337 fashion in that the associated variable OPTIND is not made local
1338 to functions.
1339
1340 Moreover, the warning and special exit code from [[ -o non_exis‐
1341 tent_option ]] are suppressed.
1342
1343 POSIX_IDENTIFIERS <K> <S>
1344 When this option is set, only the ASCII characters a to z, A to
1345 Z, 0 to 9 and _ may be used in identifiers (names of shell pa‐
1346 rameters and modules).
1347
1348 In addition, setting this option limits the effect of parameter
1349 substitution with no braces, so that the expression $# is
1350 treated as the parameter $# even if followed by a valid parame‐
1351 ter name. When it is unset, zsh allows expressions of the form
1352 $#name to refer to the length of $name, even for special vari‐
1353 ables, for example in expressions such as $#- and $#*.
1354
1355 Another difference is that with the option set assignment to an
1356 unset variable in arithmetic context causes the variable to be
1357 created as a scalar rather than a numeric type. So after `unset
1358 t; (( t = 3 ))'. without POSIX_IDENTIFIERS set t has integer
1359 type, while with it set it has scalar type.
1360
1361 When the option is unset and multibyte character support is en‐
1362 abled (i.e. it is compiled in and the option MULTIBYTE is set),
1363 then additionally any alphanumeric characters in the local char‐
1364 acter set may be used in identifiers. Note that scripts and
1365 functions written with this feature are not portable, and also
1366 that both options must be set before the script or function is
1367 parsed; setting them during execution is not sufficient as the
1368 syntax variable=value has already been parsed as a command
1369 rather than an assignment.
1370
1371 If multibyte character support is not compiled into the shell
1372 this option is ignored; all octets with the top bit set may be
1373 used in identifiers. This is non-standard but is the tradi‐
1374 tional zsh behaviour.
1375
1376 POSIX_STRINGS <K> <S>
1377 This option affects processing of quoted strings. Currently it
1378 only affects the behaviour of null characters, i.e. character 0
1379 in the portable character set corresponding to US ASCII.
1380
1381 When this option is not set, null characters embedded within
1382 strings of the form $'...' are treated as ordinary characters.
1383 The entire string is maintained within the shell and output to
1384 files where necessary, although owing to restrictions of the li‐
1385 brary interface the string is truncated at the null character in
1386 file names, environment variables, or in arguments to external
1387 programs.
1388
1389 When this option is set, the $'...' expression is truncated at
1390 the null character. Note that remaining parts of the same
1391 string beyond the termination of the quotes are not truncated.
1392
1393 For example, the command line argument a$'b\0c'd is treated with
1394 the option off as the characters a, b, null, c, d, and with the
1395 option on as the characters a, b, d.
1396
1397 POSIX_TRAPS <K> <S>
1398 When this option is set, the usual zsh behaviour of executing
1399 traps for EXIT on exit from shell functions is suppressed. In
1400 that case, manipulating EXIT traps always alters the global trap
1401 for exiting the shell; the LOCAL_TRAPS option is ignored for the
1402 EXIT trap. Furthermore, a return statement executed in a trap
1403 with no argument passes back from the function the value from
1404 the surrounding context, not from code executed within the trap.
1405
1406 SH_FILE_EXPANSION <K> <S>
1407 Perform filename expansion (e.g., ~ expansion) before parameter
1408 expansion, command substitution, arithmetic expansion and brace
1409 expansion. If this option is unset, it is performed after brace
1410 expansion, so things like `~$USERNAME' and `~{pfalstad,rc}' will
1411 work.
1412
1413 SH_NULLCMD <K> <S>
1414 Do not use the values of NULLCMD and READNULLCMD when doing
1415 redirections, use `:' instead (see the section `Redirection').
1416
1417 SH_OPTION_LETTERS <K> <S>
1418 If this option is set the shell tries to interpret single letter
1419 options (which are used with set and setopt) like ksh does.
1420 This also affects the value of the - special parameter.
1421
1422 SH_WORD_SPLIT (-y) <K> <S>
1423 Causes field splitting to be performed on unquoted parameter ex‐
1424 pansions. Note that this option has nothing to do with word
1425 splitting. (See zshexpn(1).)
1426
1427 TRAPS_ASYNC
1428 While waiting for a program to exit, handle signals and run
1429 traps immediately. Otherwise the trap is run after a child
1430 process has exited. Note this does not affect the point at
1431 which traps are run for any case other than when the shell is
1432 waiting for a child process.
1433
1434 Shell State
1435 INTERACTIVE (-i, ksh: -i)
1436 This is an interactive shell. This option is set upon initiali‐
1437 sation if the standard input is a tty and commands are being
1438 read from standard input. (See the discussion of SHIN_STDIN.)
1439 This heuristic may be overridden by specifying a state for this
1440 option on the command line. The value of this option can only
1441 be changed via flags supplied at invocation of the shell. It
1442 cannot be changed once zsh is running.
1443
1444 LOGIN (-l, ksh: -l)
1445 This is a login shell. If this option is not explicitly set,
1446 the shell becomes a login shell if the first character of the
1447 argv[0] passed to the shell is a `-'.
1448
1449 PRIVILEGED (-p, ksh: -p)
1450 Turn on privileged mode. Typically this is used when script is
1451 to be run with elevated privileges. This should be done as fol‐
1452 lows directly with the -p option to zsh so that it takes effect
1453 during startup.
1454
1455 #!/bin/zsh -p
1456
1457 The option is enabled automatically on startup if the effective
1458 user (group) ID is not equal to the real user (group) ID. In
1459 this case, turning the option off causes the effective user and
1460 group IDs to be set to the real user and group IDs. Be aware
1461 that if that fails the shell may be running with different IDs
1462 than was intended so a script should check for failure and act
1463 accordingly, for example:
1464
1465 unsetopt privileged || exit
1466
1467 The PRIVILEGED option disables sourcing user startup files. If
1468 zsh is invoked as `sh' or `ksh' with this option set,
1469 /etc/suid_profile is sourced (after /etc/profile on interactive
1470 shells). Sourcing ~/.profile is disabled and the contents of the
1471 ENV variable is ignored. This option cannot be changed using the
1472 -m option of setopt and unsetopt, and changing it inside a func‐
1473 tion always changes it globally regardless of the LOCAL_OPTIONS
1474 option.
1475
1476 RESTRICTED (-r)
1477 Enables restricted mode. This option cannot be changed using
1478 unsetopt, and setting it inside a function always changes it
1479 globally regardless of the LOCAL_OPTIONS option. See the sec‐
1480 tion `Restricted Shell'.
1481
1482 SHIN_STDIN (-s, ksh: -s)
1483 Commands are being read from the standard input. Commands are
1484 read from standard input if no command is specified with -c and
1485 no file of commands is specified. If SHIN_STDIN is set explic‐
1486 itly on the command line, any argument that would otherwise have
1487 been taken as a file to run will instead be treated as a normal
1488 positional parameter. Note that setting or unsetting this op‐
1489 tion on the command line does not necessarily affect the state
1490 the option will have while the shell is running - that is purely
1491 an indicator of whether or not commands are actually being read
1492 from standard input. The value of this option can only be
1493 changed via flags supplied at invocation of the shell. It can‐
1494 not be changed once zsh is running.
1495
1496 SINGLE_COMMAND (-t, ksh: -t)
1497 If the shell is reading from standard input, it exits after a
1498 single command has been executed. This also makes the shell
1499 non-interactive, unless the INTERACTIVE option is explicitly set
1500 on the command line. The value of this option can only be
1501 changed via flags supplied at invocation of the shell. It can‐
1502 not be changed once zsh is running.
1503
1504 Zle
1505 BEEP (+B) <D>
1506 Beep on error in ZLE.
1507
1508 COMBINING_CHARS
1509 Assume that the terminal displays combining characters cor‐
1510 rectly. Specifically, if a base alphanumeric character is fol‐
1511 lowed by one or more zero-width punctuation characters, assume
1512 that the zero-width characters will be displayed as modifica‐
1513 tions to the base character within the same width. Not all ter‐
1514 minals handle this. If this option is not set, zero-width char‐
1515 acters are displayed separately with special mark-up.
1516
1517 If this option is set, the pattern test [[:WORD:]] matches a
1518 zero-width punctuation character on the assumption that it will
1519 be used as part of a word in combination with a word character.
1520 Otherwise the base shell does not handle combining characters
1521 specially.
1522
1523 EMACS If ZLE is loaded, turning on this option has the equivalent ef‐
1524 fect of `bindkey -e'. In addition, the VI option is unset.
1525 Turning it off has no effect. The option setting is not guaran‐
1526 teed to reflect the current keymap. This option is provided for
1527 compatibility; bindkey is the recommended interface.
1528
1529 OVERSTRIKE
1530 Start up the line editor in overstrike mode.
1531
1532 SINGLE_LINE_ZLE (-M) <K>
1533 Use single-line command line editing instead of multi-line.
1534
1535 Note that although this is on by default in ksh emulation it
1536 only provides superficial compatibility with the ksh line editor
1537 and reduces the effectiveness of the zsh line editor. As it has
1538 no effect on shell syntax, many users may wish to disable this
1539 option when using ksh emulation interactively.
1540
1541 VI If ZLE is loaded, turning on this option has the equivalent ef‐
1542 fect of `bindkey -v'. In addition, the EMACS option is unset.
1543 Turning it off has no effect. The option setting is not guaran‐
1544 teed to reflect the current keymap. This option is provided for
1545 compatibility; bindkey is the recommended interface.
1546
1547 ZLE (-Z)
1548 Use the zsh line editor. Set by default in interactive shells
1549 connected to a terminal.
1550
1552 Some options have alternative names. These aliases are never used for
1553 output, but can be used just like normal option names when specifying
1554 options to the shell.
1555
1556 BRACE_EXPAND
1557 NO_IGNORE_BRACES (ksh and bash compatibility)
1558
1559 DOT_GLOB
1560 GLOB_DOTS (bash compatibility)
1561
1562 HASH_ALL
1563 HASH_CMDS (bash compatibility)
1564
1565 HIST_APPEND
1566 APPEND_HISTORY (bash compatibility)
1567
1568 HIST_EXPAND
1569 BANG_HIST (bash compatibility)
1570
1571 LOG NO_HIST_NO_FUNCTIONS (ksh compatibility)
1572
1573 MAIL_WARN
1574 MAIL_WARNING (bash compatibility)
1575
1576 ONE_CMD
1577 SINGLE_COMMAND (bash compatibility)
1578
1579 PHYSICAL
1580 CHASE_LINKS (ksh and bash compatibility)
1581
1582 PROMPT_VARS
1583 PROMPT_SUBST (bash compatibility)
1584
1585 STDIN SHIN_STDIN (ksh compatibility)
1586
1587 TRACK_ALL
1588 HASH_CMDS (ksh compatibility)
1589
1591 Default set
1592 -0 CORRECT
1593 -1 PRINT_EXIT_VALUE
1594 -2 NO_BAD_PATTERN
1595 -3 NO_NOMATCH
1596 -4 GLOB_DOTS
1597 -5 NOTIFY
1598 -6 BG_NICE
1599 -7 IGNORE_EOF
1600 -8 MARK_DIRS
1601 -9 AUTO_LIST
1602 -B NO_BEEP
1603 -C NO_CLOBBER
1604 -D PUSHD_TO_HOME
1605 -E PUSHD_SILENT
1606 -F NO_GLOB
1607 -G NULL_GLOB
1608 -H RM_STAR_SILENT
1609 -I IGNORE_BRACES
1610 -J AUTO_CD
1611 -K NO_BANG_HIST
1612 -L SUN_KEYBOARD_HACK
1613 -M SINGLE_LINE_ZLE
1614 -N AUTO_PUSHD
1615 -O CORRECT_ALL
1616 -P RC_EXPAND_PARAM
1617 -Q PATH_DIRS
1618 -R LONG_LIST_JOBS
1619 -S REC_EXACT
1620 -T CDABLE_VARS
1621 -U MAIL_WARNING
1622 -V NO_PROMPT_CR
1623 -W AUTO_RESUME
1624 -X LIST_TYPES
1625 -Y MENU_COMPLETE
1626 -Z ZLE
1627 -a ALL_EXPORT
1628 -e ERR_EXIT
1629 -f NO_RCS
1630 -g HIST_IGNORE_SPACE
1631 -h HIST_IGNORE_DUPS
1632 -i INTERACTIVE
1633 -k INTERACTIVE_COMMENTS
1634 -l LOGIN
1635 -m MONITOR
1636 -n NO_EXEC
1637 -p PRIVILEGED
1638 -r RESTRICTED
1639 -s SHIN_STDIN
1640 -t SINGLE_COMMAND
1641 -u NO_UNSET
1642 -v VERBOSE
1643 -w CHASE_LINKS
1644 -x XTRACE
1645 -y SH_WORD_SPLIT
1646
1647 sh/ksh emulation set
1648 -C NO_CLOBBER
1649 -T TRAPS_ASYNC
1650 -X MARK_DIRS
1651 -a ALL_EXPORT
1652 -b NOTIFY
1653 -e ERR_EXIT
1654 -f NO_GLOB
1655 -i INTERACTIVE
1656 -l LOGIN
1657 -m MONITOR
1658 -n NO_EXEC
1659 -p PRIVILEGED
1660 -r RESTRICTED
1661 -s SHIN_STDIN
1662 -t SINGLE_COMMAND
1663 -u NO_UNSET
1664 -v VERBOSE
1665 -x XTRACE
1666
1667 Also note
1668 -A Used by set for setting arrays
1669 -b Used on the command line to specify end of option processing
1670 -c Used on the command line to specify a single command
1671 -m Used by setopt for pattern-matching option setting
1672 -o Used in all places to allow use of long option names
1673 -s Used by set to sort positional parameters
1674
1675
1676
1677zsh 5.8.1 February 12, 2022 ZSHOPTIONS(1)