Alters the way options settings are printed: instead of separate lists
of set and unset options, all options are shown, marked ‘on’ if they are
in the non-default state, ‘off’ otherwise.
`KSH_TYPESET`
This option is now obsolete: a better appropximation to the behaviour of
other shells is obtained with the reserved word interface to `declare`,
`export`, `float`, `integer`, `local`, `readonly` and `typeset`. Note
that the option is only applied when the reserved word interface is
*not* in use.
Alters the way arguments to the `typeset` family of commands, including
`declare`, `export`, `float`, `integer`, `local` and `readonly`, are
processed. Without this option, zsh will perform normal word splitting
after command and parameter expansion in arguments of an assignment;
with it, word splitting does not take place in those cases.
`KSH_ZERO_SUBSCRIPT`
Treat use of a subscript of value zero in array or string expressions as
a reference to the first element, i.e. the element that usually has the
subscript 1. Ignored if `KSH_ARRAYS` is also set.
If neither this option nor `KSH_ARRAYS` is set, accesses to an element
of an array or string with subscript zero return an empty element or
string, while attempts to set element zero of an array or string are
treated as an error. However, attempts to set an otherwise valid
subscript range that includes zero will succeed. For example, if
`KSH_ZERO_SUBSCRIPT` is not set,
``` example
array[0]=(element)
```
is an error, while
``` example
array[0,1]=(element)
```
is not and will replace the first element of the array.
This option is for compatibility with older versions of the shell and is
not recommended in new code.
`POSIX_ALIASES` \ \
When this option is set, reserved words are not candidates for alias
expansion: it is still possible to declare any of them as an alias, but
the alias will never be expanded. Reserved words are described in
[Reserved Words](Shell-Grammar.html#Reserved-Words).
Alias expansion takes place while text is being read; hence when this
option is set it does not take effect until the end of any function or
other piece of shell code parsed as one unit. Note this may cause
differences from other shells even when the option is in effect. For
example, when running a command with ‘`zsh -c`’, or even ‘`zsh -o
posixaliases -c`’, the entire command argument is parsed as one unit, so
aliases defined within the argument are not available even in later
lines. If in doubt, avoid use of aliases in non-interactive code.
`POSIX_ARGZERO`
This option may be used to temporarily disable `FUNCTION_ARGZERO` and
thereby restore the value of `$0` to the name used to invoke the shell
(or as set by the `-c` command line option). For compatibility with
previous versions of the shell, emulations use `NO_FUNCTION_ARGZERO`
instead of `POSIX_ARGZERO`, which may result in unexpected scoping of
`$0` if the emulation mode is changed inside a function or script. To
avoid this, explicitly enable `POSIX_ARGZERO` in the `emulate` command:
``` example
emulate sh -o POSIX_ARGZERO
```
Note that `NO_POSIX_ARGZERO` has no effect unless `FUNCTION_ARGZERO` was
already enabled upon entry to the function or script.
`POSIX_BUILTINS` \ \
When this option is set the `command` builtin can be used to execute
shell builtin commands. Parameter assignments specified before shell
functions and special builtins are kept after the command completes
unless the special builtin is prefixed with the `command` builtin.
Special builtins are `.`, `:`, `break`, `continue`, `declare`, `eval`,
`exit`, `export`, `integer`, `local`, `readonly`, `return`, `set`,
`shift`, `source`, `times`, `trap` and `unset`.
In addition, various error conditions associated with the above builtins
or `exec` cause a non-interactive shell to exit and an interactive shell
to return to its top-level processing.
Furthermore, functions and shell builtins are not executed after an
`exec` prefix; the command to be executed must be an external command
found in the path.
Furthermore, the `getopts` builtin behaves in a POSIX-compatible fashion
in that the associated variable `OPTIND` is not made local to functions.
Moreover, the warning and special exit code from ` [[ -o
``non_existent_option`` ]] ` are suppressed.
`POSIX_IDENTIFIERS` \ \
When this option is set, only the ASCII characters `a` to `z`, `A` to
`Z`, `0` to `9` and `_` may be used in identifiers (names of shell
parameters and modules).
In addition, setting this option limits the effect of parameter
substitution with no braces, so that the expression `$#` is treated as
the parameter `$#` even if followed by a valid parameter name. When it
is unset, zsh allows expressions of the form `$#``name` to refer to the
length of `$``name`, even for special variables, for example in
expressions such as `$#-` and `$#*`.
Another difference is that with the option set assignment to an unset
variable in arithmetic context causes the variable to be created as a
scalar rather than a numeric type. So after ‘`unset t; (( t = 3 ))`’.
without `POSIX_IDENTIFIERS` set `t` has integer type, while with it set
it has scalar type.
When the option is unset and multibyte character support is enabled
(i.e. it is compiled in and the option `MULTIBYTE` is set), then
additionally any alphanumeric characters in the local character set may
be used in identifiers. Note that scripts and functions written with
this feature are or function is parsed; setting them during execution is
not sufficient as the syntax `variable``=``value` has already been
parsed as a command rather than an assignment.
If multibyte character support is not compiled into the shell this
option is ignored; all octets with the top bit set may be used in
identifiers. This is non-standard but is the traditional zsh behaviour.
`POSIX_STRINGS` \ \
This option affects processing of quoted strings. Currently it only
affects the behaviour of null characters, i.e. character 0 in the
When this option is not set, null characters embedded within strings of
the form `$’``...``’` are treated as ordinary characters. The entire
string is maintained within the shell and output to files where
necessary, although owing to restrictions of the library interface the
string is truncated at the null character in file names, environment
variables, or in arguments to external programs.
When this option is set, the `$’``...``’` expression is truncated at the
null character. Note that remaining parts of the same string beyond the
termination of the quotes are not truncated.
For example, the command line argument `a$’b\0c’d` is treated with the
option off as the characters `a`, `b`, null, `c`, `d`, and with the
option on as the characters `a`, `b`, `d`.
`POSIX_TRAPS` \ \
When this option is set, the usual zsh behaviour of executing traps for
`EXIT` on exit from shell functions is suppressed. In that case,
manipulating `EXIT` traps always alters the global trap for exiting the
shell; the `LOCAL_TRAPS` option is ignored for the `EXIT` trap.
Furthermore, a `return` statement executed in a trap with no argument
passes back from the function the value from the surrounding context,
not from code executed within the trap.
`SH_FILE_EXPANSION` \ \
Perform filename expansion (e.g., `~` expansion) *before* parameter
expansion, command substitution, arithmetic expansion and brace
expansion. If this option is unset, it is performed *after* brace
expansion, so things like ‘`~$USERNAME`’ and ‘`~{pfalstad,rc}`’ will
work.
`SH_NULLCMD` \ \
Do not use the values of `NULLCMD` and `READNULLCMD` when doing
redirections, use ‘`:`’ instead (see
[Redirection](Redirection.html#Redirection)).
`SH_OPTION_LETTERS` \ \
If this option is set the shell tries to interpret single letter options
(which are used with `set` and `setopt`) like ksh does. This also
affects the value of the `-` special parameter.
`SH_WORD_SPLIT` (`-y`) \ \
Causes field splitting to be performed on unquoted parameter expansions.
Note that this option has nothing to do with word splitting. (See
[Parameter Expansion](Expansion.html#Parameter-Expansion).)
`TRAPS_ASYNC`
While waiting for a program to exit, handle signals and run traps
immediately. Otherwise the trap is run after a child process has exited.
Note this does not affect the point at which traps are run for any case
other than when the shell is waiting for a child process.
-----
### 16.2.11 Shell State
`INTERACTIVE` (`-i`, ksh: `-i`)
This is an interactive shell. This option is set upon initialisation if
the standard input is a tty and commands are being read from standard
input. (See the discussion of `SHIN_STDIN`.) This heuristic may be
overridden by specifying a state for this option on the command line.
The value of this option can only be changed via flags supplied at
invocation of the shell. It cannot be changed once zsh is running.
`LOGIN` (`-l`, ksh: `-l`)
This is a login shell. If this option is not explicitly set, the shell
becomes a login shell if the first character of the `argv[0]` passed to
the shell is a ‘`-`’.
`PRIVILEGED` (`-p`, ksh: `-p`)
Turn on privileged mode. Typically this is used when script is to be run
with elevated privileges. This should be done as follows directly with
the `-p` option to zsh so that it takes effect during startup.
``` example
#!/bin/zsh -p
```
The option is enabled automatically on startup if the effective user
(group) ID is not equal to the real user (group) ID. In this case,
turning the option off causes the effective user and group IDs to be set
to the real user and group IDs. Be aware that if that fails the shell
may be running with different IDs than was intended so a script should
check for failure and act accordingly, for example:
``` example
unsetopt privileged || exit
```
The `PRIVILEGED` option disables sourcing user startup files. If zsh is
invoked as ‘`sh`’ or ‘`ksh`’ with this option set, `/etc/suid_profile`
is sourced (after `/etc/profile` on interactive shells). Sourcing
`~/.profile` is disabled and the contents of the `ENV` variable is
ignored. This option cannot be changed using the `-m` option of `setopt`
and `unsetopt`, and changing it inside a function always changes it
globally regardless of the `LOCAL_OPTIONS` option.
`RESTRICTED` (`-r`)
Enables restricted mode. This option cannot be changed using `unsetopt`,
and setting it inside a function always changes it globally regardless
of the `LOCAL_OPTIONS` option. See [Restricted
Shell](Invocation.html#Restricted-Shell).
`SHIN_STDIN` (`-s`, ksh: `-s`)
Commands are being read from the standard input. Commands are read from
standard input if no command is specified with `-c` and no file of
commands is specified. If `SHIN_STDIN` is set explicitly on the command
line, any argument that would otherwise have been taken as a file to run
will instead be treated as a normal positional parameter. Note that
setting or unsetting this option on the command line does not
necessarily affect the state the option will have while the shell is
running - that is purely an indicator of whether or not commands are
*actually* being read from standard input. The value of this option can
only be changed via flags supplied at invocation of the shell. It cannot
be changed once zsh is running.
`SINGLE_COMMAND` (`-t`, ksh: `-t`)
If the shell is reading from standard input, it exits after a single
command has been executed. This also makes the shell non-interactive,
unless the `INTERACTIVE` option is explicitly set on the command line.
The value of this option can only be changed via flags supplied at
invocation of the shell. It cannot be changed once zsh is running.
-----
### 16.2.12 Zle
`BEEP` (`+B`) \
Beep on error in ZLE.
`COMBINING_CHARS`
Assume that the terminal displays combining characters correctly.
Specifically, if a base alphanumeric character is followed by one or
more zero-width punctuation characters, assume that the zero-width
characters will be displayed as modifications to the base character
within the same width. Not all terminals handle this. If this option is
not set, zero-width characters are displayed separately with special
mark-up.
If this option is set, the pattern test `[[:WORD:]]` matches a
zero-width punctuation character on the assumption that it will be used
as part of a word in combination with a word character. Otherwise the
base shell does not handle combining characters specially.
`EMACS`
If ZLE is loaded, turning on this option has the equivalent effect of
‘`bindkey -e`’. In addition, the VI option is unset. Turning it off
has no effect. The option setting is not guaranteed to reflect the
current keymap. This option is provided for compatibility; `bindkey` is
the recommended interface.
`OVERSTRIKE`
Start up the line editor in overstrike mode.
`SINGLE_LINE_ZLE` (`-M`) \
Use single-line command line editing instead of multi-line.
Note that although this is on by default in ksh emulation it only
provides superficial compatibility with the ksh line editor and reduces
the effectiveness of the zsh line editor. As it has no effect on shell
syntax, many users may wish to disable this option when using ksh
emulation interactively.
`VI`
If ZLE is loaded, turning on this option has the equivalent effect of
‘`bindkey -v`’. In addition, the EMACS option is unset. Turning it off
has no effect. The option setting is not guaranteed to reflect the
current keymap. This option is provided for compatibility; `bindkey` is
the recommended interface.
`ZLE` (`-Z`)
Use the zsh line editor. Set by default in interactive shells connected
to a terminal.
-----
## 16.3 Option Aliases
Some options have alternative names. These aliases are never used for
output, but can be used just like normal option names when specifying
options to the shell.
`BRACE_EXPAND`
*NO\_*`IGNORE_BRACES` (ksh and bash compatibility)
`DOT_GLOB`
`GLOB_DOTS` (bash compatibility)
`HASH_ALL`
`HASH_CMDS` (bash compatibility)
`HIST_APPEND`
`APPEND_HISTORY` (bash compatibility)
`HIST_EXPAND`
`BANG_HIST` (bash compatibility)
`LOG`
*NO\_*`HIST_NO_FUNCTIONS` (ksh compatibility)
`MAIL_WARN`
`MAIL_WARNING` (bash compatibility)
`ONE_CMD`
`SINGLE_COMMAND` (bash compatibility)
`PHYSICAL`
`CHASE_LINKS` (ksh and bash compatibility)
`PROMPT_VARS`
`PROMPT_SUBST` (bash compatibility)
`STDIN`
`SHIN_STDIN` (ksh compatibility)
`TRACK_ALL`
`HASH_CMDS` (ksh compatibility)
-----
## 16.4 Single Letter Options
-----
### 16.4.1 Default set
- `-0`
CORRECT
- `-1`
PRINT\_EXIT\_VALUE
- `-2`
*NO\_*BAD\_PATTERN
- `-3`
*NO\_*NOMATCH
- `-4`
GLOB\_DOTS
- `-5`
NOTIFY
- `-6`
BG\_NICE
- `-7`
IGNORE\_EOF
- `-8`
MARK\_DIRS
- `-9`
AUTO\_LIST
- `-B`
*NO\_*BEEP
- `-C`
*NO\_*CLOBBER
- `-D`
PUSHD\_TO\_HOME
- `-E`
PUSHD\_SILENT
- `-F`
*NO\_*GLOB
- `-G`
NULL\_GLOB
- `-H`
RM\_STAR\_SILENT
- `-I`
IGNORE\_BRACES
- `-J`
AUTO\_CD
- `-K`
*NO\_*BANG\_HIST
- `-L`
SUN\_KEYBOARD\_HACK
- `-M`
SINGLE\_LINE\_ZLE
- `-N`
AUTO\_PUSHD
- `-O`
CORRECT\_ALL
- `-P`
RC\_EXPAND\_PARAM
- `-Q`
PATH\_DIRS
- `-R`
LONG\_LIST\_JOBS
- `-S`
REC\_EXACT
- `-T`
CDABLE\_VARS
- `-U`
MAIL\_WARNING
- `-V`
*NO\_*PROMPT\_CR
- `-W`
AUTO\_RESUME
- `-X`
LIST\_TYPES
- `-Y`
MENU\_COMPLETE
- `-Z`
ZLE
- `-a`
ALL\_EXPORT
- `-e`
ERR\_EXIT
- `-f`
*NO\_*RCS
- `-g`
HIST\_IGNORE\_SPACE
- `-h`
HIST\_IGNORE\_DUPS
- `-i`
INTERACTIVE
- `-k`
INTERACTIVE\_COMMENTS
- `-l`
LOGIN
- `-m`
MONITOR
- `-n`
*NO\_*EXEC
- `-p`
PRIVILEGED
- `-r`
RESTRICTED
- `-s`
SHIN\_STDIN
- `-t`
SINGLE\_COMMAND
- `-u`
*NO\_*UNSET
- `-v`
VERBOSE
- `-w`
CHASE\_LINKS
- `-x`
XTRACE
- `-y`
SH\_WORD\_SPLIT
-----
### 16.4.2 sh/ksh emulation set
- `-C`
*NO\_*CLOBBER
- `-T`
TRAPS\_ASYNC
- `-X`
MARK\_DIRS
- `-a`
ALL\_EXPORT
- `-b`
NOTIFY
- `-e`
ERR\_EXIT
- `-f`
*NO\_*GLOB
- `-i`
INTERACTIVE
- `-l`
LOGIN
- `-m`
MONITOR
- `-n`
*NO\_*EXEC
- `-p`
PRIVILEGED
- `-r`
RESTRICTED
- `-s`
SHIN\_STDIN
- `-t`
SINGLE\_COMMAND
- `-u`
*NO\_*UNSET
- `-v`
VERBOSE
- `-x`
XTRACE
-----
### 16.4.3 Also note
- `-A`
Used by `set` for setting arrays
- `-b`
Used on the command line to specify end of option processing
- `-c`
Used on the command line to specify a single command
- `-m`
Used by `setopt` for pattern-matching option setting
- `-o`
Used in all places to allow use of long option names
- `-s`
Used by `set` to sort positional parameters
-----
This document was generated on *February 15, 2020* using
[*texi2html 5.0*](http://www.nongnu.org/texi2html/).
Zsh version 5.8, released on February 14, 2020.