Table B.4. Environment Variables
|
|
Variable
|
Chapter
|
Type
|
Description
|
|
*
|
4
|
R
|
The positional parameters given to the current script or
function.
|
|
@
|
4
|
R
|
The positional parameters given to the current script or function.
|
|
#
|
4
|
R
|
The number of arguments given to the current script or
function.
|
|
-
|
|
R
|
Options given to the shell on invocation.
|
|
?
|
5
|
R
|
Exit status of the previous command.
|
|
|
|
R
|
Last argument to the previous command.
|
|
$
|
8
|
R
|
Process ID of the shell process.
|
|
!
|
8
|
R
|
Process ID of the last background command.
|
|
0
|
4
|
R
|
Name of the shell or shell script.
|
|
BASH
|
3
|
|
The full pathname used to invoke this instance of bash.
|
|
BASH_ENV
|
3
|
|
The name of a file to run as the environment file when the
shell is invoked.
|
|
BASH_VERSION
|
3
|
|
The version number of this instance of bash.
|
|
BASH_VERSINFO
|
3,6
|
AR
|
Version information for this instance of bash. Each element of the array holds parts of the
version number.
|
|
CDPATH
|
3
|
L
|
A list of directories for the cd
command to search.
|
|
DIRSTACK
|
4,6
|
ARU
|
The current contents of the directory stack.
|
|
EUID
|
|
R
|
The effective user ID of the current user.
|
|
FCEDIT
|
2
|
|
The default editor for fc
command.
|
|
FIGNORE
|
|
L
|
A list of names to ignore when doing filename completion.
|
|
GLOBIGNORE
|
|
L
|
A list of patterns defining filenames to ignore during
pathname expansion.
|
|
GROUPS
|
|
AR
|
An array containing a list of groups of which the current
user is a member.
|
|
IFS
|
7
|
|
The Internal Field Separator: a list of characters that act
as word separators. Normally set to SPACE, TAB, and NEWLINE.
|
|
HISTCMD
|
3
|
U
|
The history number of the current command.
|
|
HISTCONTROL
|
3
|
|
Controls what is entered in the command history.
|
|
HISTFILE
|
2
|
|
The name of the command history file.
|
|
HISTIGNORE
|
3
|
|
A list of patterns to decide what should be retained in the
history list.
|
|
HISTSIZE
|
2
|
|
The number of lines kept in the command history.
|
|
HISTFILESIZE
|
3
|
|
The maximum number of lines kept in the history file.
|
|
HOME
|
3
|
|
The home (login) directory.
|
|
HOSTFILE
|
3
|
|
The file to be used for hostname completion.
|
|
HOSTNAME
|
|
|
The name of the current host.
|
|
HOSTTYPE
|
3
|
|
The type of machine bash is
running on.
|
|
IGNOREEOF
|
3
|
|
The number of EOF characters received before exiting an
interactive shell.
|
|
INPUTRC
|
2
|
|
The readline startup file.
|
|
LANG
|
|
|
Used to determine the locale category for any category not
specifically selected with a variable starting with LC_.
|
|
LC_ALL
|
|
|
Overrides the value of LANG and any other LC_ variable specifying a locale category.
|
|
LC_COLLATE
|
|
|
Determines the collation order used when sorting the results
of pathname expansion.
|
|
LC_MESSAGES
|
|
|
This variable determines the locale used to translate
double-quoted strings preceded by a $.
|
|
LINENO
|
9
|
U
|
The number of the line that just ran in a script or
function.
|
|
MACHTYPE
|
|
|
A string describing the system on which bash is executing.
|
|
MAIL
|
3
|
|
The name of the file to check for new mail.
|
|
MAILCHECK
|
3
|
|
How often (in seconds) to check for new
mail.
|
|
MAILPATH
|
3
|
L
|
A list of file names to check for new mail,
if MAIL is not set.
|
|
OLDPWD
|
3
|
|
The previous working directory.
|
|
OPTARG
|
6
|
|
The value of the last option argument
processed by getopts.
|
|
OPTERR
|
6
|
|
If set to 1, display error messages from getopts.
|
|
OPTIND
|
6
|
|
The number of the first argument after
options.
|
|
OSTYPE
|
|
|
The operating system on which bash is executing.
|
|
PATH
|
3
|
L
|
The search path for commands.
|
|
PIPESTATUS
|
6
|
A
|
An array variable containing a list of exit
status values from the processes in the most recently executed foreground
pipeline.
|
|
PROMPT_COMMAND
|
|
|
The value is executed as a command before
the primary prompt is issued.
|
|
PS1
|
3
|
|
The primary command prompt string.
|
|
PS2
|
3
|
|
The prompt string for line continuations.
|
|
PS3
|
5
|
|
The prompt string for the select command.
|
|
PS4
|
9
|
|
The prompt string for the xtrace option.
|
|
PPID
|
8
|
R
|
The process ID of the parent process.
|
|
PWD
|
3
|
|
The current working directory.
|
|
RANDOM
|
9
|
U
|
A random number between 0 and 32767 (215-1).
|
|
REPLY
|
5, 7
|
|
The user's response to the select command; result of the read command if no variable names are given.
|
|
SECONDS
|
3
|
U
|
The number of seconds since the shell was
invoked.
|
|
SHELL
|
3
|
|
The full pathname of the shell.
|
|
SHELLOPTS
|
|
LR
|
A list of enabled shell options.
|
|
SHLVL
|
|
|
Incremented by one each time an instance of
bash is invoked.
|
|
TIMEFORMAT
|
|
|
Specifies the format for the output from
using the time reserved word on a command
pipeline.
|
|
TMOUT
|
10
|
|
If set to a positive integer, the number of
seconds after which the shell automatically terminates if no input is
received.
|
|
UID
|
|
R
|
The user ID of the current user.
|
|
auto_resume
|
|
|
Controls how job control works.
|
|
histchars
|
|
|
Specifies what to use as the history
control characters. Normally set to the string `!#'.
|