Parameters Set By The Shell
===========================
The following parameters are automatically set by the shell:
! <S>
The process ID of the last background command invoked.
# <S>
The number of positional parameters in decimal. Note that some
confusion may occur with the syntax $#PARAM which substitutes the
length of PARAM. Use ${#} to resolve ambiguities. In particular,
the sequence `$#-...' in an arithmetic expression is interpreted as
the length of the parameter -, q.v.
ARGC <S> <Z>
Same as #.
$ <S>
The process ID of this shell.
- <S>
Flags supplied to the shell on invocation or by the set or setopt
commands.
* <S>
An array containing the positional parameters.
argv <S> <Z>
Same as *. Assigning to argv changes the local positional
parameters, but argv is _not_ itself a local parameter. Deleting
argv with unset in any function deletes it everywhere, although
only the innermost positional parameter array is deleted (so * and
@ in other scopes are not affected).
@ <S>
Same as argv[@], even when argv is not set.
? <S>
The exit value returned by the last command.
0 <S>
The name used to invoke the current shell. If the
FUNCTION_ARGZERO option is set, this is set temporarily within a
shell function to the name of the function, and within a sourced
script to the name of the script.
status <S> <Z>
Same as ?.
pipestatus <S> <Z>
An array containing the exit values returned by all commands in the
last pipeline.
_ <S>
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.
CPUTYPE
The machine type (microprocessor class or machine model), as
determined at run time.
EGID <S>
The effective group ID of the shell process. If you have
sufficient privileges, you may change the effective group ID of
the shell process by assigning to this parameter. Also (assuming
sufficient privileges), you may start a single command with a
different effective group ID by `(EGID=GID; command)'
EUID <S>
The effective user ID of the shell process. If you have sufficient
privileges, you may change the effective user ID of the shell
process by assigning to this parameter. Also (assuming sufficient
privileges), you may start a single command with a different
effective user ID by `(EUID=UID; command)'
ERRNO <S>
The value of errno (see man page errno(3)) as set by the most
recently failed system call. This value is system dependent and
is intended for debugging purposes.
GID <S>
The real group ID of the shell process. If you have sufficient
privileges, you may change the group ID of the shell process by
assigning to this parameter. Also (assuming sufficient
privileges), you may start a single command under a different
group ID by `(GID=GID; command)'
HOST
The current hostname.
LINENO <S>
The line number of the current line within the current script,
sourced file, or shell function being executed, whichever was
started most recently. Note that in the case of shell functions
the line number refers to the function as it appeared in the
original definition, not necessarily as displayed by the functions
builtin.
LOGNAME
If the corresponding variable is not set in the environment of the
shell, it is initialized to the login name corresponding to the
current login session. This parameter is exported by default but
this can be disabled using the typeset builtin.
MACHTYPE
The machine type (microprocessor class or machine model), as
determined at compile time.
OLDPWD
The previous working directory. This is set when the shell
initializes and whenever the directory changes.
OPTARG <S>
The value of the last option argument processed by the getopts
command.
OPTIND <S>
The index of the last option argument processed by the getopts
command.
OSTYPE
The operating system, as determined at compile time.
PPID <S>
The process ID of the parent of the shell.
PWD
The present working directory. This is set when the shell
initializes and whenever the directory changes.
RANDOM <S>
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 <S>
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 <S>
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.
TTYIDLE <S>
The idle time of the tty associated with the shell in seconds or
-1 if there is no such tty.
UID <S>
The real user ID of the shell process. If you have sufficient
privileges, you may change the user ID of the shell by assigning
to this parameter. Also (assuming sufficient privileges), you may
start a single command under a different user ID by `(UID=UID;
command)'
USERNAME <S>
The username corresponding to the real user ID of the shell
process. If you have sufficient privileges, you may change the
username (and also the user ID and group ID) of the shell by
assigning to this parameter. Also (assuming sufficient
privileges), you may start a single command under a different
username (and user ID and group ID) by `(USERNAME=USERNAME;
command)'
VENDOR
The vendor, as determined at compile time.
ZSH_NAME
Expands to the basename of the command used to invoke this instance
of zsh.
ZSH_VERSION
The version number of this zsh.