Chapter 5: Shell Variables

77

MAILCHECK

How often (in seconds) that the shell should check for mail in the files specified in the MAILPATH or MAIL variables. The default is 60 seconds. When it is time to check for mail, the shell does so before displaying the primary prompt. If this variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking.

MAPFILE

An array variable created to hold the text read by the mapfile builtin when no variable name is supplied.

OLDPWD

The previous working directory as set by the cd builtin.

OPTERR

If set to the value 1, Bash displays error messages generated by the getopts builtin command.

OSTYPE

A string describing the operating system Bash is running on.

PIPESTATUS

An array variable (see Section 6.7 [Arrays], page 89) containing a list of exit sta- tus values from the processes in the most-recently-executed foreground pipeline

(which may contain only a single command).

POSIXLY_CORRECT

If this variable is in the environment when Bash starts, the shell enters posix mode (see Section 6.11 [Bash POSIX Mode], page 94) before reading the startup files, as if the --posix invocation option had been supplied. If it is set while the shell is running, Bash enables posix mode, as if the command set -o posix had been executed.

PPID

The process id of the shell’s parent process. This variable is readonly.

PROMPT_COMMAND

If set, the value is interpreted as a command to execute before the printing of each primary prompt ($PS1).

PROMPT_DIRTRIM

If set to a number greater than zero, the value is used as the number of trailing directory components to retain when expanding the \w and \W prompt string escapes (see Section 6.9 [Controlling the Prompt], page 92). Characters removed are replaced with an ellipsis.

PS3

The value of this variable is used as the prompt for the select command. If this variable is not set, the select command prompts with ‘#? ’

PS4

The value is the prompt printed before the command line is echoed when the -x option is set (see Section 4.3.1 [The Set Builtin], page 58). The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is ‘+ ’.

PWD

The current working directory as set by the cd builtin.

RANDOM

Each time this parameter is referenced, a random integer between 0 and 32767 is generated. Assigning a value to this variable seeds the random number gen- erator.