Bash Conditional Expressions
Bash Features
Shell Arithmetic
These variables are set or used by Bash, but other shells do not normally treat them specially.
BASH
|
The full pathname used to execute the current instance of Bash. | ||||||||||||
BASH_ENV
|
If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup file to read before executing the script. See Bash Startup Files. | ||||||||||||
BASH_VERSION
|
The version number of the current instance of Bash. | ||||||||||||
BASH_VERSINFO
|
A readonly array variable whose members hold version information for this instance of Bash. The values assigned to the array members are as follows:
| ||||||||||||
DIRSTACK
|
An array variable (see Arrays)
containing the current contents of the directory stack.
Directories appear in the stack in the order they are displayed by the
| ||||||||||||
EUID
|
The numeric effective user id of the current user. This variable is readonly. | ||||||||||||
FCEDIT
|
The editor used as a default by the ` | ||||||||||||
FIGNORE
|
A colon-separated list of suffixes to ignore when performing
filename completion.
A file name whose suffix matches one of the entries in
| ||||||||||||
GLOBIGNORE
|
A colon-separated list of patterns defining the set of filenames to
be ignored by filename expansion.
If a filename matched by a filename expansion pattern also matches one
of the patterns in | ||||||||||||
GROUPS
|
An array variable containing the list of groups of which the current user is a member. This variable is readonly. | ||||||||||||
histchars
|
Up to three characters which control history expansion, quick
substitution, and tokenization (see History Interaction).
The first character is the
history-expansion-char, that is, the character which signifies the
start of a history expansion, normally ` | ||||||||||||
HISTCMD
|
The history number, or index in the history list, of the current
command. If | ||||||||||||
HISTCONTROL
|
Set to a value of ` | ||||||||||||
HISTIGNORE
|
A colon-separated list of patterns used to decide which command
lines should be saved on the history list. Each pattern is
anchored at the beginning of the line and must fully specify the
line (no implicit `
| ||||||||||||
HISTFILE
|
The name of the file to which the command history is saved. The
default is ` | ||||||||||||
HISTSIZE
|
The maximum number of commands to remember on the history list. The default value is 500. | ||||||||||||
HISTFILESIZE
|
The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is truncated, if necessary, to contain no more than that number of lines. The default value is 500. The history file is also truncated to this size after writing it when an interactive shell exits. | ||||||||||||
HOSTFILE
|
Contains the name of a file in the same format as ` | ||||||||||||
HOSTNAME
|
The name of the current host. | ||||||||||||
HOSTTYPE
|
A string describing the machine Bash is running on. | ||||||||||||
IGNOREEOF
|
Controls the action of the shell on receipt of an | ||||||||||||
INPUTRC
|
The name of the Readline startup file, overriding the default
of ` | ||||||||||||
LANG
|
Used to determine the locale category for any category not specifically
selected with a variable starting with | ||||||||||||
LC_ALL
|
This variable overrides the value of | ||||||||||||
LC_COLLATE
|
This variable determines the collation order used when sorting the results of filename expansion, and determines the behavior of range expressions, equivalence classes, and collating sequences within filename expansion and pattern matching (see Filename Expansion). | ||||||||||||
LC_CTYPE
|
This variable determines the interpretation of characters and the behavior of character classes within filename expansion and pattern matching (see Filename Expansion). | ||||||||||||
LC_MESSAGES
|
This variable determines the locale used to translate double-quoted
strings preceded by a ` | ||||||||||||
LINENO
|
The line number in the script or shell function currently executing. | ||||||||||||
MACHTYPE
|
A string that fully describes the system type on which Bash is executing, in the standard GNU cpu-company-system format. | ||||||||||||
MAILCHECK
|
How often (in seconds) that the shell should check for mail in the
files specified in the | ||||||||||||
OLDPWD
|
The previous working directory as set by the | ||||||||||||
OPTERR
|
If set to the value 1, Bash displays error messages
generated by the | ||||||||||||
OSTYPE
|
A string describing the operating system Bash is running on. | ||||||||||||
PIPESTATUS
|
An array variable (see Arrays) containing a list of exit status values from the processes in the most-recently-executed foreground pipeline (which may contain only a single command). | ||||||||||||
PPID
|
The process id of the shell's parent process. This variable is readonly. | ||||||||||||
PROMPT_COMMAND
|
If present, this contains a string which is a command to execute
before the printing of each primary prompt ( | ||||||||||||
PS3
|
The value of this variable is used as the prompt for the
| ||||||||||||
PS4
|
This is the prompt printed before the command line is echoed
when the ` | ||||||||||||
PWD
|
The current working directory as set by the | ||||||||||||
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 generator. | ||||||||||||
REPLY
|
The default variable for the | ||||||||||||
SECONDS
|
This variable expands to the number of seconds since the shell was started. Assignment to this variable resets the count to the value assigned, and the expanded value becomes the value assigned plus the number of seconds since the assignment. | ||||||||||||
SHELLOPTS
|
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the ` | ||||||||||||
SHLVL
|
Incremented by one each time a new instance of Bash is started. This is intended to be a count of how deeply your Bash shells are nested. | ||||||||||||
TIMEFORMAT
|
The value of this parameter is used as a format string specifying
how the timing information for pipelines prefixed with the
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 If this variable is not set, Bash acts as if it had the value
If the value is null, no timing information is displayed. A trailing newline is added when the format string is displayed. | ||||||||||||
TMOUT
|
If set to a value greater than zero, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. Bash terminates after that number of seconds if input does not arrive. | ||||||||||||
UID
|
The numeric real user id of the current user. This variable is readonly. |