These variables are set or used by Bash, but other shells do not normally treat them specially.
A few variables used by Bash are described in different chapters: variables for controlling the job control facilities (see Job Control Variables).
BASH
BASHOPTS
shopt
builtin command (see The Shopt Builtin).
The options appearing in BASHOPTS are those reported
as ‘on’ by ‘shopt’.
If this variable is in the environment when Bash
starts up, each shell option in the list will be enabled before
reading any startup files. This variable is readonly.
BASHPID
$$
under certain circumstances, such as subshells
that do not require Bash to be re-initialized.
BASH_ALIASES
alias
builtin
(see Bourne Shell Builtins).
Elements added to this array appear in the alias list; unsetting array
elements cause aliases to be removed from the alias list.
BASH_ARGC
.
or source
) is at the top of the stack. When a
subroutine is executed, the number of parameters passed is pushed onto
BASH_ARGC
.
The shell sets BASH_ARGC
only when in extended debugging mode
(see The Shopt Builtin
for a description of the extdebug
option to the shopt
builtin).
BASH_ARGV
BASH_ARGV
.
The shell sets BASH_ARGV
only when in extended debugging mode
(see The Shopt Builtin
for a description of the extdebug
option to the shopt
builtin).
BASH_CMDS
hash
builtin
(see Bourne Shell Builtins).
Elements added to this array appear in the hash table; unsetting array
elements cause commands to be removed from the hash table.
BASH_COMMAND
BASH_ENV
BASH_EXECUTION_STRING
BASH_LINENO
${BASH_LINENO[$i]}
is the line number in the source file where
${FUNCNAME[$i]}
was called (or ${BASH_LINENO[$i-1]}
if
referenced within another shell function).
The corresponding source file name is ${BASH_SOURCE[$i]}
.
Use LINENO
to obtain the current line number.
BASH_REMATCH
[[
conditional command
(see Conditional Constructs).
The element with index 0 is the portion of the string
matching the entire regular expression.
The element with index n is the portion of the
string matching the nth parenthesized subexpression.
This variable is read-only.
BASH_SOURCE
FUNCNAME
array variable.
BASH_SUBSHELL
BASH_VERSINFO
BASH_VERSINFO[0]
BASH_VERSINFO[1]
BASH_VERSINFO[2]
BASH_VERSINFO[3]
BASH_VERSINFO[4]
BASH_VERSINFO[5]
BASH_VERSION
BASH_XTRACEFD
BASH_XTRACEFD
is unset or assigned
a new value.
Unsetting BASH_XTRACEFD
or assigning it the empty string causes the
trace output to be sent to the standard error.
Note that setting BASH_XTRACEFD
to 2 (the standard error file
descriptor) and then unsetting it will result in the standard error
being closed.
COLUMNS
select
builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a
SIGWINCH
.
COMP_CWORD
COMP_LINE
COMP_POINT
${#COMP_LINE}
.
This variable is available only in shell functions and external
commands invoked by the
programmable completion facilities (see Programmable Completion).
COMP_TYPE
COMP_KEY
COMP_WORDBREAKS
COMP_WORDBREAKS
is unset, it loses its special properties,
even if it is subsequently reset.
COMP_WORDS
COMP_WORDBREAKS
as described above.
This variable is available only in shell functions invoked by the
programmable completion facilities (see Programmable Completion).
COMPREPLY
DIRSTACK
dirs
builtin.
Assigning to members of this array variable may be used to modify
directories already in the stack, but the pushd
and popd
builtins must be used to add and remove directories.
Assignment to this variable will not change the current directory.
If DIRSTACK is unset, it loses its special properties, even if
it is subsequently reset.
EMACS
EUID
FCEDIT
fc
builtin command.
FIGNORE
FUNCNAME
"main"
.
This variable exists only when a shell function is executing.
Assignments to FUNCNAME have no effect and return an error status.
If FUNCNAME is unset, it loses its special properties, even if
it is subsequently reset.
GLOBIGNORE
GROUPS
histchars
HISTCMD
HISTCONTROL
HISTFILE
HISTFILESIZE
HISTIGNORE
HISTIGNORE subsumes the function of HISTCONTROL. A
pattern of ‘&’ is identical to ignoredups
, and a
pattern of ‘[ ]*’ is identical to ignorespace
.
Combining these two patterns, separating them with a colon,
provides the functionality of ignoreboth
.
HISTSIZE
HISTTIMEFORMAT
history
builtin.
If this variable is set, time stamps are written to the history file so
they may be preserved across shell sessions.
This uses the history comment character to distinguish timestamps from
other history lines.
HOSTFILE
HOSTNAME
HOSTTYPE
IGNOREEOF
EOF
character
as the sole input. If set, the value denotes the number
of consecutive EOF
characters that can be read as the
first character on an input line
before the shell will exit. If the variable exists but does not
have a numeric value (or has no value) then the default is 10.
If the variable does not exist, then EOF
signifies the end of
input to the shell. This is only in effect for interactive shells.
INPUTRC
LANG
LC_
.
LC_ALL
LC_
variable specifying a locale category.
LC_COLLATE
LC_CTYPE
LC_MESSAGES
LC_NUMERIC
LINENO
LINES
select
builtin command to determine the column length
for printing selection lists. Automatically set upon receipt of a
SIGWINCH
.
MACHTYPE
MAILCHECK
OLDPWD
cd
builtin.
OPTERR
getopts
builtin command.
OSTYPE
PIPESTATUS
POSIXLY_CORRECT
bash
starts, the shell
enters posix mode (see Bash POSIX Mode) 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
PROMPT_COMMAND
PROMPT_DIRTRIM
\w
and
\W
prompt string escapes (see Printing a Prompt).
Characters removed are replaced with an ellipsis.
PS3
select
command. If this variable is not set, the
select
command prompts with ‘#? ’
PS4
PWD
cd
builtin.
RANDOM
REPLY
read
builtin.
SECONDS
SHELL
SHELLOPTS
set
builtin command (see The Set Builtin).
The options appearing in SHELLOPTS are those reported
as ‘on’ by ‘set -o’.
If this variable is in the environment when Bash
starts up, each shell option in the list will be enabled before
reading any startup files. This variable is readonly.
SHLVL
TIMEFORMAT
time
reserved word should be displayed.
The ‘%’ character introduces an
escape sequence that is expanded to a time value or other
information.
The escape sequences and their meanings are as
follows; the braces denote optional portions.
%%
%[
p][l]R
%[
p][l]U
%[
p][l]S
%P
The optional p is a digit specifying the precision, the number of fractional digits after a decimal point. A value of 0 causes no decimal point or fraction to be output. At most three places after the decimal point may be specified; values of p greater than 3 are changed to 3. If p is not specified, the value 3 is used.
The optional l
specifies a longer format, including minutes, of
the form MMmSS.FFs.
The value of p determines whether or not the fraction is included.
If this variable is not set, Bash acts as if it had the value
$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'
If the value is null, no timing information is displayed.
A trailing newline is added when the format string is displayed.
TMOUT
TMOUT
is treated as the
default timeout for the read
builtin (see Bash Builtins).
The select
command (see Conditional Constructs) terminates
if input does not arrive after TMOUT
seconds when input is coming
from a terminal.
In an interactive shell, the value is interpreted as
the number of seconds to wait for input after issuing the primary
prompt when the shell is interactive.
Bash terminates after that number of seconds if input does
not arrive.
TMPDIR
UID