Table of Contents
Special Parameters
The following parameters are automatically set by the shell:
- !
- The process id of the last background command invoked.
- #
-
The number of positional parameters in decimal.
- ARGC
-
Same as #.
- $
- The process id of this shell.
- -
-
Flags supplied to the shell on invocation or by the set or
setopt commands.
- *
-
An array containing the positional parameters.
- argv
-
Same as *.
- @
- Same as argv[@].
- ?
-
The exit value returned by the last command.
- status
-
Same as ?.
- _
-
The last argument of the previous command. Also, this parameter is set
in the environment of every command executed to the full pathname of
the command.
- EGID
-
The effective group id of the shell process.
- EUID
-
The effective user id of the shell process.
- ERRNO
-
The value of errno as set by the most recently failed system
call. This value is system dependent and is intended for debugging
purposes.
- GID
- The group id of the shell process.
- HOST
- The current hostname.
- HOSTTYPE
-
A string corresponding to the type of the host the shell is running on.
- LINENO
-
The line number of the current line within the current script being
executed.
- OLDPWD
-
The previous working directory.
- OPTARG
-
The value of the last option argument processed by the getopts
command.
- OPTIND
-
The index of the last option argument processed by the getopts
command.
- PPID
-
The process id of the parent of the shell. PWD The present
working directory.
- RANDOM
-
A random integer from 0 to 32767, newly generated each time this
parameter is referenced. The random number generator can be seeded by
assigning a numeric value to RANDOM.
- SECONDS
-
The number of seconds since shell invocation. If this parameter is
assigned a value, then the value returned upon reference will be the
value that was assigned plus the number of seconds since the
assignment.
- SHLVL
-
Incremented by one each time a new shell is started.
- signals
-
An array containing the names of the signals.
- TTY
-
The name of the tty associated with the shell, if any.
- UID
-
The user id of the shell process.
- USERNAME
LOGNAME
-
The username corresponding to the user id of the shell process.
- VERSION
-
The version number of this zsh.
The following parameters are used by the shell:
- ARGV0
-
If exported, it's value is used as argv[0] of external
commands. Usually used in constructs like `ARGV0=emacs nethack'.
- BAUD
-
The baud rate of the current connection. Used by the line editor
update mechanism to compensate for a slow terminal by delaying updates
until necessary. This may be profitably set to a lower value in some
circumstances, e.g. for slow modems dialing into a communications
server which is connected to a host via a fast link; in this case,
this variable would be set by default to the speed of the fast link,
and not the modem. This parameter should be set to the baud rate of
the slowest part of the link for best performance. The compensation
mechanism can be turned off by setting the variable to zero.
- cdpath (CDPATH)
-
An array (colon-separated list) of directories specifying the search
path for the cd command.
- COLUMNS
-
The number of columns for this terminal session. Used for printing
select lists and for the line editor.
- DIRSTACKSIZE
-
The maximum size of the directory stack. If the stack gets larger than
this, it will be truncated automatically. This is useful with the
AUTO_PUSHD option.
- FCEDIT
-
The default editor for the fc builtin.
- fignore (FIGNORE)
-
An array (colon separated list) containing the suffixes of files to be
ignored during filename completion.
- fpath (FPATH)
-
An array (colon separated list) of directories specifying the search
path for function definitions. This path is searched when a function
with the -u attribute is referenced. If an executable file is
found, then it is read and executed in the current environment.
- HISTCHARS
-
Three characters used by the shell's history and lexical analysis
mechanism. The first character signals the start of a history
substitution (default `!'). The second character signals the start of
a quick history substitution (default `^'). The third character is the
comment character (default `#').
- HISTFILE
-
The file to save the history in when an interactive shell exits. If
unset, the history is not saved.
- HISTSIZE
-
The maximum size of the history list.
- HOME
-
The default argument for the cd command.
- IFS
-
Internal field separators, normally space, tab, and newline, that are
used to separate words which result from command or parameter
substitution and words read by the read builtin.
- KEYTIMEOUT
-
The time the shell waits, in hundredths of seconds, for another key to
be pressed when reading bound multi-character sequences.
- LINES
-
The number of lines for this terminal session. Used for printing
select lists and for the line editor.
- LISTMAX
-
In the line editor, the number of filenames to list without asking
first. If set to zero, the shell asks only if the top of the listing
would scroll off the screen.
- LITHISTSIZE
-
The maximum size of the literal history list (before history expansion).
- LOGCHECK
-
The interval in seconds between checks for login/logout activity using
the watch parameter.
- MAIL
-
If this parameter is set and mailpath is not set, the shell
looks for mail in the specified file. By default it is set to the
user's system mailbox.
- MAILCHECK
-
The interval in seconds between checks for new mail.
- mailpath (MAILPATH)
-
An array (colon-separated list) of filenames to check for new
mail. Each filename can be followed by a ? and a message that will be
printed. The sequence $_ in the message will be replaced by the name
of the mail file. The default message is "You have new
mail." If an element is a directory instead of a file the shell
will recursively check every file in every subdirectory of the
element.
- manpath (MANPATH)
-
An array (colon-separated list) whose value is not used by the
shell. The manpath array can be useful, however, since setting
it also sets MANPATH, and vice versa.
- NULLCMD
-
The command name to assume if a redirection is specified with no
command. Defaults to cat. For sh/ksh-like behavior, change this
to :. For cshlike behavior, unset this parameter; the shell
will print an error message if null commands are entered.
- path (PATH)
-
An array (colon-separated list) of directories to search for
commands. When this parameter is set, each directory is scanned and
all files found are put in a hash table.
- POSTEDIT
-
This string is output whenever the line editor exits. It usually
contains termcap strings to reset the terminal.
- PROMPT
-
The primary prompt string, printed before a command is read; the
default is "%m%# ". If the escape sequence takes an optional
integer, it should appear between the `%' and the next character of
the sequence. The following escape sequences are recognized:
- PROMPT2
-
The secondary prompt, printed when the shell needs more information to
complete a command. Recognizes the same escape sequences as
$PROMPT. The default is "> ".
- PROMPT3
-
Selection prompt used within a select loop. Recognizes the same
escape sequences as $PROMPT. The default is "?#
".
- PROMPT4
-
The execution trace prompt. Default is "+".
- PS1
PS2
PS3
PS4
-
Same as PROMPT, PROMPT2, PROMPT3, and
PROMPT4, respectively.
- psvar (PSVAR)
-
An array (colon-separated list) whose first nine values can be used in
PROMPT strings. Setting psvar also sets PSVAR,
and vice versa.
- prompt
-
Same as PROMPT.
- READNULLCMD
-
The command name to assume if a single input redirection is specified
with no command. Defaults to more.
- REPORTTIME
-
If nonnegative, commands whose combined user and system execution
times (measured in seconds) are greater than this value have timing
statistics printed for them.
- RPROMPT
RPS1
-
This prompt is displayed on the right-hand side of the screen when the
primary prompt is being displayed on the left. This does not work if
the SINGLELINEZLE option is set. Recognizes the same escape
sequences as PROMPT.
- SAVEHIST
-
The maximum number of history events to save in the history file.
- SPROMPT
-
The prompt used for spelling correction. The sequence %R
expands to the string which presumably needs spelling correction, and
%r expands to the proposed correction. All other PROMPT
escapes are also allowed.
- STTY
-
If this parameter is set in a command's environment, the shell runs
the stty command with the value of this parameter as arguments
in order to set up the terminal before executing the command. The
modes apply only to the command, and are reset when it finishes or is
suspended. If the command is suspended and continued later with the
fg or wait builtins it will see the modes specified by
STTY, as if it were not suspended. This (intentionally) does not apply
if the command is continued via "kill -CONT". STTY is ignored if
the command is run in the background, or if it is in the environment
of the shell but not explicitly assigned to in the input line. This
avoids running stty at every external command by accidentally
exporting it. Also note that STTY should not be used for window size
specifications; these will not be local to the command.
- TIMEFMT
-
The format of process time reports with the time keyword. The
default is
"%E real %U user %S system %P %J". Recognizes the
following escape
sequences:
- TMOUT
-
If this parameter is nonzero, the shell will terminate if a command is
not entered within the specified number of seconds after issuing a
prompt.
- TMPPREFIX
-
A pathname prefix which the shell will use for all temporary
files. Note that this should include an initial part for the file name
as well as any directory names. The default is /tmp/zsh.
- watch (WATCH)
-
An array (colon-separated list) of login/logout events to report. If
it contains the single word "all", then all login/logout events
are reported. If it contains the single word "notme", then all
events are reported as with "all" except $USERNAME. An entry
in this list may consist of a username, an `@' followed by a remote
hostname, and a `%' followed by a line (tty). Any or all of these
components may be present in an entry; if a login/logout event matches
all of them, it is reported.
- WATCHFMT
-
The format of login/logout reports if the watch parameter is
set. Default is "%n has %a %l from %m." Recognizes the
following escape
sequences:
- WORDCHARS
-
A list of nonalphanumeric characters considered part of a word by the
line editor.
- ZDOTDIR
-
The directory to search for shell startup files (.zshrc, etc), if not
$HOME.
Mark D. Borges