summaryrefslogtreecommitdiff
path: root/doc/bash.1
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-10-11 14:49:26 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-10-11 15:19:40 -0700
commit011c1d1c0766c65517ebd495465c99e86edb63ec (patch)
tree30d8f6a13235af90897c3223554871ef52225462 /doc/bash.1
parent40cfaccf7b178b6239b5cd0013ef80b7ff8e503e (diff)
downloadvyatta-bash-011c1d1c0766c65517ebd495465c99e86edb63ec.tar.gz
vyatta-bash-011c1d1c0766c65517ebd495465c99e86edb63ec.zip
Update to bash-4.1
Diffstat (limited to 'doc/bash.1')
-rw-r--r--doc/bash.11421
1 files changed, 1108 insertions, 313 deletions
diff --git a/doc/bash.1 b/doc/bash.1
index fe0dba0..1890b3c 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -2,16 +2,15 @@
.\" MAN PAGE COMMENTS to
.\"
.\" Chet Ramey
-.\" Information Network Services
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
-.\" Last Change: Thu Sep 28 10:25:59 EDT 2006
+.\" Last Change: Tue Dec 29 15:36:16 EST 2009
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2006 September 28" "GNU Bash-3.2"
+.TH BASH 1 "2009 December 29" "GNU Bash-4.1"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -51,8 +50,8 @@ bash \- GNU Bourne-Again SHell
[options]
[file]
.SH COPYRIGHT
-.if n Bash is Copyright (C) 1989-2005 by the Free Software Foundation, Inc.
-.if t Bash is Copyright \(co 1989-2005 by the Free Software Foundation, Inc.
+.if n Bash is Copyright (C) 1989-2009 by the Free Software Foundation, Inc.
+.if t Bash is Copyright \(co 1989-2009 by the Free Software Foundation, Inc.
.SH DESCRIPTION
.B Bash
is an \fBsh\fR-compatible command language interpreter that
@@ -185,9 +184,7 @@ Display a usage message on standard output and exit successfully.
.PD
Execute commands from
.I file
-instead of the system wide initialization file
-.I /etc/bash.bashrc
-and the standard personal initialization file
+instead of the standard personal initialization file
.I ~/.bashrc
if the shell is interactive (see
.SM
@@ -218,9 +215,7 @@ reads these files when it is invoked as a login shell (see
below).
.TP
.B \-\-norc
-Do not read and execute the system wide initialization file
-.I /etc/bash.bashrc
-and the personal initialization file
+Do not read and execute the personal initialization file
.I ~/.bashrc
if the shell is interactive.
This option is on by default if the shell is invoked as
@@ -328,15 +323,13 @@ exists.
.PP
When an interactive shell that is not a login shell is started,
.B bash
-reads and executes commands from \fI/etc/bash.bashrc\fP and \fI~/.bashrc\fP,
-if these files exist.
+reads and executes commands from \fI~/.bashrc\fP, if that file exists.
This may be inhibited by using the
.B \-\-norc
option.
The \fB\-\-rcfile\fP \fIfile\fP option will force
.B bash
-to read and execute commands from \fIfile\fP instead of
-\fI/etc/bash.bashrc\fP and \fI~/.bashrc\fP.
+to read and execute commands from \fIfile\fP instead of \fI~/.bashrc\fP.
.PP
When
.B bash
@@ -416,13 +409,13 @@ whose name is the expanded value.
No other startup files are read.
.PP
.B Bash
-attempts to determine when it is being run by the remote shell
-daemon, usually \fIrshd\fP.
+attempts to determine when it is being run with its standard input
+connected to a a network connection, as if by the remote shell
+daemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP.
If
.B bash
-determines it is being run by \fIrshd\fP, it reads and executes
-commands from \fI/etc/bash.bashrc\fP and \fI~/.bashrc\fP,
-if these files exist and are readable.
+determines it is being run in this fashion, it reads and executes
+commands from \fI~/.bashrc\fP, if that file exists and is readable.
It will not do this if invoked as \fBsh\fP.
The
.B \-\-norc
@@ -436,8 +429,15 @@ If the shell is started with the effective user (group) id not equal to the
real user (group) id, and the \fB\-p\fP option is not supplied, no startup
files are read, shell functions are not inherited from the environment, the
.SM
-.B SHELLOPTS
-variable, if it appears in the environment, is ignored,
+.BR SHELLOPTS ,
+.SM
+.BR BASHOPTS ,
+.SM
+.BR CDPATH ,
+and
+.SM
+.B GLOBIGNORE
+variables, if they appear in the environment, are ignored,
and the effective user id is set to the real user id.
If the \fB\-p\fP option is supplied at invocation, the startup behavior is
the same, but the effective user id is not reset.
@@ -478,8 +478,8 @@ A \fItoken\fP that performs a control function. It is one of the following
symbols:
.RS
.PP
-.if t \fB\(bv\(bv & && ; ;; ( ) | <newline>\fP
-.if n \fB|| & && ; ;; ( ) | <newline>\fP
+.if t \fB\(bv\(bv & && ; ;; ( ) | |& <newline>\fP
+.if n \fB|| & && ; ;; ( ) | |& <newline>\fP
.RE
.PD
.SH "RESERVED WORDS"
@@ -514,12 +514,13 @@ The return value of a \fIsimple command\fP is its exit status, or
.SS Pipelines
.PP
A \fIpipeline\fP is a sequence of one or more commands separated by
-the character
-.BR | .
+one of the control operators
+.B |
+or \fB|&\fP.
The format for a pipeline is:
.RS
.PP
-[\fBtime\fP [\fB\-p\fP]] [ ! ] \fIcommand\fP [ \fB|\fP \fIcommand2\fP ... ]
+[\fBtime\fP [\fB\-p\fP]] [ ! ] \fIcommand\fP [ [\fB|\fP\(bv\fB|&\fP] \fIcommand2\fP ... ]
.RE
.PP
The standard output of
@@ -531,6 +532,11 @@ command (see
.SM
.B REDIRECTION
below).
+If \fB|&\fP is used, the standard error of \fIcommand\fP is connected to
+\fIcommand2\fP's standard input through the pipe; it is shorthand for
+\fB2>&1 |\fP.
+This implicit redirection of the standard error is performed after any
+redirections specified by the command.
.PP
The return status of a pipeline is the exit status of the last
command, unless the \fBpipefail\fP option is enabled.
@@ -585,7 +591,7 @@ and
have equal precedence, followed by
.B ;
and
-.BR &,
+.BR & ,
which have equal precedence.
.PP
A sequence of one or more newlines may appear in a \fIlist\fP instead
@@ -601,11 +607,9 @@ are executed sequentially; the shell waits for each
command to terminate in turn. The return status is the
exit status of the last command executed.
.PP
-The control operators
-.B &&
-and
-.B \(bv\(bv
-denote AND lists and OR lists, respectively.
+AND and OR lists are sequences of one of more pipelines separated by the
+\fB&&\fP and \fB\(bv\(bv\fP control operators, respectively.
+AND and OR lists are executed with left associativity.
An AND list has the form
.RS
.PP
@@ -627,7 +631,8 @@ An OR list has the form
.I command2
is executed if and only if
.I command1
-returns a non-zero exit status. The return status of
+returns a non-zero exit status.
+The return status of
AND and OR lists is the exit status of the last command
executed in the list.
.SS Compound Commands
@@ -653,7 +658,8 @@ The return status is the exit status of
Note that unlike the metacharacters \fB(\fP and \fB)\fP, \fB{\fP and
\fB}\fP are \fIreserved words\fP and must occur where a reserved
word is permitted to be recognized. Since they do not cause a word
-break, they must be separated from \fIlist\fP by whitespace.
+break, they must be separated from \fIlist\fP by whitespace or another
+shell metacharacter.
.TP
((\fIexpression\fP))
The \fIexpression\fP is evaluated according to the rules described
@@ -678,6 +684,10 @@ Conditional operators such as \fB\-f\fP must be unquoted to be recognized
as primaries.
.if t .sp 0.5
.if n .sp 1
+When used with \fB[[\fP, The \fB<\fP and \fB>\fP operators sort
+lexicographically using the current locale.
+.if t .sp 0.5
+.if n .sp 1
When the \fB==\fP and \fB!=\fP operators are used, the string to the
right of the operator is considered a pattern and matched according
to the rules described below under \fBPattern Matching\fP.
@@ -703,11 +713,21 @@ If the shell option
.B nocasematch
is enabled, the match is performed without regard to the case
of alphabetic characters.
+Any part of the pattern may be quoted to force it to be matched as a
+string.
Substrings matched by parenthesized subexpressions within the regular
-expression are saved in the array variable \fBBASH_REMATCH\fP.
-The element of \fBBASH_REMATCH\fP with index 0 is the portion of the string
+expression are saved in the array variable
+.SM
+.BR BASH_REMATCH .
+The element of
+.SM
+.B BASH_REMATCH
+with index 0 is the portion of the string
matching the entire regular expression.
-The element of \fBBASH_REMATCH\fP with index \fIn\fP is the portion of the
+The element of
+.SM
+.B BASH_REMATCH
+with index \fIn\fP is the portion of the
string matching the \fIn\fPth parenthesized subexpression.
.if t .sp 0.5
.if n .sp 1
@@ -751,7 +771,7 @@ operators do not evaluate \fIexpression2\fP if the value of
the entire conditional expression.
.RE
.TP
-\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fBdo\fP \fIlist\fP ; \fBdone\fP
+\fBfor\fP \fIname\fP [ [ \fBin\fP [ \fIword ...\fP ] ] ; ] \fBdo\fP \fIlist\fP ; \fBdone\fP
The list of words following \fBin\fP is expanded, generating a list
of items.
The variable \fIname\fP is set to each element of this list
@@ -786,6 +806,7 @@ error, each preceded by a number. If the \fBin\fP
.SM
.B PARAMETERS
below). The
+.SM
.B PS3
prompt is then displayed and a line read from the standard input.
If the line consists of a number corresponding to one of
@@ -796,6 +817,7 @@ are displayed again. If EOF is read, the command completes. Any
other value read causes
.I name
to be set to null. The line read is saved in the variable
+.SM
.BR REPLY .
The
.I list
@@ -825,9 +847,15 @@ If the shell option
.B nocasematch
is enabled, the match is performed without regard to the case
of alphabetic characters.
-When a match is found, the
-corresponding \fIlist\fP is executed. After the first match, no
-subsequent matches are attempted. The exit status is zero if no
+When a match is found, the corresponding \fIlist\fP is executed.
+If the \fB;;\fP operator is used, no subsequent matches are attempted after
+the first pattern match.
+Using \fB;&\fP in place of \fB;;\fP causes execution to continue with
+the \fIlist\fP associated with the next set of patterns.
+Using \fB;;&\fP in place of \fB;;\fP causes the shell to test the next
+pattern list in the statement, if any, and execute any associated \fIlist\fP
+on a successful match.
+The exit status is zero if no
pattern matches. Otherwise, it is the exit status of the
last command executed in \fIlist\fP.
.TP
@@ -864,6 +892,49 @@ The exit status of the \fBwhile\fP and \fBuntil\fP commands
is the exit status
of the last \fBdo\fP \fIlist\fP command executed, or zero if
none was executed.
+.SS Coprocesses
+.PP
+A \fIcoprocess\fP is a shell command preceded by the \fBcoproc\fP reserved
+word.
+A coprocess is executed asynchronously in a subshell, as if the command
+had been terminated with the \fB&\fP control operator, with a two-way pipe
+established between the executing shell and the coprocess.
+.PP
+The format for a coprocess is:
+.RS
+.PP
+\fBcoproc\fP [\fINAME\fP] \fIcommand\fP [\fIredirections\fP]
+.RE
+.PP
+This creates a coprocess named \fINAME\fP.
+If \fINAME\fP is not supplied, the default name is \fICOPROC\fP.
+\fINAME\fP must not be supplied if \fIcommand\fP is a \fIsimple
+command\fP (see above); otherwise, it is interpreted as the first word
+of the simple command.
+When the coproc is executed, the shell creates an array variable (see
+.B Arrays
+below) named \fINAME\fP in the context of the executing shell.
+The standard output of
+.I command
+is connected via a pipe to a file descriptor in the executing shell,
+and that file descriptor is assigned to \fINAME\fP[0].
+The standard input of
+.I command
+is connected via a pipe to a file descriptor in the executing shell,
+and that file descriptor is assigned to \fINAME\fP[1].
+This pipe is established before any redirections specified by the
+command (see
+.SM
+.B REDIRECTION
+below).
+The file descriptors can be utilized as arguments to shell commands
+and redirections using standard word expansions.
+The process id of the shell spawned to execute the coprocess is
+available as the value of the variable \fINAME\fP_PID.
+The \fBwait\fP
+builtin command may be used to wait for the coprocess to terminate.
+.PP
+The return status of a coprocess is the exit status of \fIcommand\fP.
.SS Shell Function Definitions
.PP
A shell function is an object that is called like a simple command and
@@ -949,19 +1020,19 @@ between single quotes, even when preceded by a backslash.
Enclosing characters in double quotes preserves the literal value
of all characters within the quotes, with the exception of
.BR $ ,
-.BR ` ,
+.BR \` ,
.BR \e ,
and, when history expansion is enabled,
.BR ! .
The characters
.B $
and
-.B `
+.B \`
retain their special meaning within double quotes. The backslash
retains its special meaning only when followed by one of the following
characters:
.BR $ ,
-.BR ` ,
+.BR \` ,
\^\fB"\fP\^,
.BR \e ,
or
@@ -999,6 +1070,8 @@ alert (bell)
backspace
.TP
.B \ee
+.TP
+.B \eE
an escape character
.TP
.B \ef
@@ -1021,6 +1094,9 @@ backslash
.TP
.B \e\(aq
single quote
+.TP
+.B \e\(dq
+double quote
.TP
.B \e\fInnn\fP
the eight-bit character whose value is the octal value \fInnn\fP
@@ -1038,8 +1114,8 @@ a control-\fIx\fP character
The expanded result is single-quoted, as if the dollar sign had
not been present.
.PP
-A double-quoted string preceded by a dollar sign (\fB$\fP) will cause
-the string to be translated according to the current locale.
+A double-quoted string preceded by a dollar sign (\fB$\fP\(dq\fIstring\fP\(dq)
+will cause the string to be translated according to the current locale.
If the current locale is \fBC\fP or \fBPOSIX\fP, the dollar sign
is ignored.
If the string is translated and replaced, the replacement is
@@ -1123,7 +1199,9 @@ When += is applied to an array variable using compound assignment (see
.B Arrays
below), the
variable's value is not unset (as it is when using =), and new values are
-appended to the array beginning at one greater than the array's maximum index.
+appended to the array beginning at one greater than the array's maximum index
+(for indexed arrays) or added as additional key\-value pairs in an
+associative array.
When applied to a string-valued variable, \fIvalue\fP is expanded and
appended to the variable's value.
.SS Positional Parameters
@@ -1192,7 +1270,7 @@ expand to nothing (i.e., they are removed).
Expands to the number of positional parameters in decimal.
.TP
.B ?
-Expands to the status of the most recently executed foreground
+Expands to the exit status of the most recently executed foreground
pipeline.
.TP
.B \-
@@ -1252,34 +1330,80 @@ The following variables are set by the shell:
Expands to the full file name used to invoke this instance of
.BR bash .
.TP
+.B BASHOPTS
+A colon-separated list of enabled shell options. Each word in
+the list is a valid argument for the
+.B \-s
+option to the
+.B shopt
+builtin command (see
+.SM
+.B "SHELL BUILTIN COMMANDS"
+below). The options appearing in
+.SM
+.B BASHOPTS
+are those reported as
+.I on
+by \fBshopt\fP.
+If this variable is in the environment when
+.B bash
+starts up, each shell option in the list will be enabled before
+reading any startup files.
+This variable is read-only.
+.TP
+.B BASHPID
+Expands to the process id of the current \fBbash\fP process.
+This differs from \fB$$\fP under certain circumstances, such as subshells
+that do not require \fBbash\fP to be re-initialized.
+.TP
+.B BASH_ALIASES
+An associative array variable whose members correspond to the internal
+list of aliases as maintained by the \fBalias\fP builtin
+Elements added to this array appear in the alias list; unsetting array
+elements cause aliases to be removed from the alias list.
+.TP
.B BASH_ARGC
An array variable whose values are the number of parameters in each
-frame of the current bash execution call stack.
+frame of the current \fBbash\fP execution call stack.
The number of
parameters to the current subroutine (shell function or script executed
with \fB.\fP or \fBsource\fP) is at the top of the stack.
When a subroutine is executed, the number of parameters passed is pushed onto
-\fBBASH_ARGC\fP.
-The shell sets \fBBASH_ARGC\fP only when in extended debugging mode
-(see the description of the
+.SM
+.BR BASH_ARGC .
+The shell sets
+.SM
+.B BASH_ARGC
+only when in extended debugging mode (see the description of the
.B extdebug
option to the
.B shopt
builtin below)
.TP
.B BASH_ARGV
-An array variable containing all of the parameters in the current bash
+An array variable containing all of the parameters in the current \fBbash\fP
execution call stack. The final parameter of the last subroutine call
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
-are pushed onto \fBBASH_ARGV\fP.
-The shell sets \fBBASH_ARGV\fP only when in extended debugging mode
+are pushed onto
+.SM
+.BR BASH_ARGV .
+The shell sets
+.SM
+.B BASH_ARGV
+only when in extended debugging mode
(see the description of the
.B extdebug
option to the
.B shopt
builtin below)
.TP
+.B BASH_CMDS
+An associative array variable whose members correspond to the internal
+hash table of commands as maintained by the \fBhash\fP builtin.
+Elements added to this array appear in the hash table; unsetting array
+elements cause commands to be removed from the hash table.
+.TP
.B BASH_COMMAND
The command currently being executed or about to be executed, unless the
shell is executing a command as the result of a trap,
@@ -1290,11 +1414,18 @@ The command argument to the \fB\-c\fP invocation option.
.TP
.B BASH_LINENO
An array variable whose members are the line numbers in source files
-corresponding to each member of \fBFUNCNAME\fP.
+corresponding to each member of
+.SM
+.BR FUNCNAME .
\fB${BASH_LINENO[\fP\fI$i\fP\fB]}\fP is the line number in the source
-file where \fB${FUNCNAME[\fP\fI$ifP\fB]}\fP was called.
-The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i\fP\fB]}\fB.
-Use \fBLINENO\fP to obtain the current line number.
+file where \fB${FUNCNAME[\fP\fI$i\fP\fB]}\fP was called
+(or \fB${BASH_LINENO[\fP\fI$i-1\fP\fB]}\fP if referenced within another
+shell function).
+The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i\fP\fB]}\fP.
+Use
+.SM
+.B LINENO
+to obtain the current line number.
.TP
.B BASH_REMATCH
An array variable whose members are assigned by the \fB=~\fP binary
@@ -1307,7 +1438,10 @@ This variable is read-only.
.TP
.B BASH_SOURCE
An array variable whose members are the source filenames corresponding
-to the elements in the \fBFUNCNAME\fP array variable.
+to the elements in the
+.SM
+.B FUNCNAME
+array variable.
.TP
.B BASH_SUBSHELL
Incremented by one each time a subshell or subshell environment is spawned.
@@ -1338,7 +1472,9 @@ The build version.
The release status (e.g., \fIbeta1\fP).
.TP
.B BASH_VERSINFO[\fR5\fP]
-The value of \fBMACHTYPE\fP.
+The value of
+.SM
+.BR MACHTYPE .
.PD
.RE
.TP
@@ -1353,6 +1489,10 @@ This variable is available only in shell functions invoked by the
programmable completion facilities (see \fBProgrammable Completion\fP
below).
.TP
+.B COMP_KEY
+The key (or final key of a key sequence) used to invoke the current
+completion function.
+.TP
.B COMP_LINE
The current command line.
This variable is available only in shell functions and external
@@ -1370,8 +1510,22 @@ commands invoked by the
programmable completion facilities (see \fBProgrammable Completion\fP
below).
.TP
+.B COMP_TYPE
+Set to an integer value corresponding to the type of completion attempted
+that caused a completion function to be called:
+\fITAB\fP, for normal completion,
+\fI?\fP, for listing completions after successive tabs,
+\fI!\fP, for listing alternatives on partial word completion,
+\fI@\fP, to list completions if the word is not unmodified,
+or
+\fI%\fP, for menu completion.
+This variable is available only in shell functions and external
+commands invoked by the
+programmable completion facilities (see \fBProgrammable Completion\fP
+below).
+.TP
.B COMP_WORDBREAKS
-The set of characters that the Readline library treats as word
+The set of characters that the \fBreadline\fP library treats as word
separators when performing word completion.
If
.SM
@@ -1382,8 +1536,10 @@ subsequently reset.
.B COMP_WORDS
An array variable (see \fBArrays\fP below) consisting of the individual
words in the current command line.
-The words are split on shell metacharacters as the shell parser would
-separate them.
+The line is split into words as \fBreadline\fP would split it, using
+.SM
+.B COMP_WORDBREAKS
+as described above.
This variable is available only in shell functions invoked by the
programmable completion facilities (see \fBProgrammable Completion\fP
below).
@@ -1417,7 +1573,9 @@ An array variable containing the names of all shell functions
currently in the execution call stack.
The element with index 0 is the name of any currently-executing
shell function.
-The bottom-most element is "main".
+The bottom-most element is
+.if t \f(CW"main"\fP.
+.if n "main".
This variable exists only when a shell function is executing.
Assignments to
.SM
@@ -1620,6 +1778,28 @@ A sample value is
.if t \f(CW".:~:/usr"\fP.
.if n ".:~:/usr".
.TP
+.B BASH_XTRACEFD
+If set to an integer corresponding to a valid file descriptor, \fBbash\fP
+will write the trace output generated when
+.if t \f(CWset -x\fP
+.if n \fIset -x\fP
+is enabled to that file descriptor.
+The file descriptor is closed when
+.SM
+.B BASH_XTRACEFD
+is unset or assigned a new value.
+Unsetting
+.SM
+.B BASH_XTRACEFD
+or assigning it the empty string causes the
+trace output to be sent to the standard error.
+Note that setting
+.SM
+.B BASH_XTRACEFD
+to 2 (the standard error file
+descriptor) and then unsetting it will result in the standard error
+being closed.
+.TP
.B COLUMNS
Used by the \fBselect\fP builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a SIGWINCH.
@@ -1654,9 +1834,7 @@ A filename whose suffix matches one of the entries in
is excluded from the list of matched filenames.
A sample value is
.if t \f(CW".o:~"\fP.
-.if n ".o:~"
-(Quoting is needed when assigning a value to this variable,
-which contains tildes).
+.if n ".o:~".
.TP
.B GLOBIGNORE
A colon-separated list of patterns defining the set of filenames to
@@ -1686,12 +1864,17 @@ A value of
causes all previous lines matching the current line to be removed from
the history list before that line is saved.
Any value not in the above list is ignored.
-If \fBHISTCONTROL\fP is unset, or does not include a valid value,
+If
+.SM
+.B HISTCONTROL
+is unset, or does not include a valid value,
all lines read by the shell parser are saved on the history list,
subject to the value of
+.SM
.BR HISTIGNORE .
The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
+.SM
.BR HISTCONTROL .
.TP
.B HISTFILE
@@ -1715,6 +1898,7 @@ should be saved on the history list. Each pattern is anchored at the
beginning of the line and must match the complete line (no implicit
`\fB*\fP' is appended). Each pattern is tested against the line
after the checks specified by
+.SM
.B HISTCONTROL
are applied.
In addition to the normal shell pattern matching characters, `\fB&\fP'
@@ -1722,6 +1906,7 @@ matches the previous history line. `\fB&\fP' may be escaped using a
backslash; the backslash is removed before attempting a match.
The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
+.SM
.BR HISTIGNORE .
.TP
.B HISTSIZE
@@ -1736,6 +1921,8 @@ for \fIstrftime\fP(3) to print the time stamp associated with each history
entry displayed by the \fBhistory\fP 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.
.TP
.B HOME
The home directory of the current user; the default argument for the
@@ -1756,7 +1943,8 @@ adds the contents of the new file to the existing list.
If
.SM
.B HOSTFILE
-is set, but has no value, \fBbash\fP attempts to read
+is set, but has no value, or does not name a readable file,
+\fBbash\fP attempts to read
.FN /etc/hosts
to obtain the list of possible hostname completions.
When
@@ -1807,7 +1995,10 @@ Used to determine the locale category for any category not specifically
selected with a variable starting with \fBLC_\fP.
.TP
.B LC_ALL
-This variable overrides the value of \fBLANG\fP and any other
+This variable overrides the value of
+.SM
+.B LANG
+and any other
\fBLC_\fP variable specifying a locale category.
.TP
.B LC_COLLATE
@@ -1830,7 +2021,9 @@ This variable determines the locale category used for number formatting.
.TP
.B LINES
Used by the \fBselect\fP builtin command to determine the column length
-for printing selection lists. Automatically set upon receipt of a SIGWINCH.
+for printing selection lists. Automatically set upon receipt of a
+.SM
+.BR SIGWINCH .
.TP
.B MAIL
If this parameter is set to a file name and the
@@ -1886,8 +2079,10 @@ the shell looks for commands (see
.SM
.B COMMAND EXECUTION
below).
-A zero-length (null) directory name in the value of \fBPATH\fP indicates the
-current directory.
+A zero-length (null) directory name in the value of
+.SM
+.B PATH
+indicates the current directory.
A null directory name may appear as two adjacent colons, or as an initial
or trailing colon.
The default path is system-dependent,
@@ -1911,6 +2106,14 @@ had been executed.
If set, the value is executed as a command prior to issuing each primary
prompt.
.TP
+.B 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 \fB\ew\fP and
+\fB\eW\fP prompt string escapes (see
+.SM
+.B PROMPTING
+below). Characters removed are replaced with an ellipsis.
+.TP
.B PS1
The value of this parameter is expanded (see
.SM
@@ -1920,6 +2123,7 @@ below) and used as the primary prompt string. The default value is
.TP
.B PS2
The value of this parameter is expanded as with
+.SM
.B PS1
and used as the secondary prompt string. The default is
``\fB> \fP''.
@@ -1934,6 +2138,7 @@ above).
.TP
.B PS4
The value of this parameter is expanded as with
+.SM
.B PS1
and the value is printed before each command
.B bash
@@ -1997,10 +2202,16 @@ If the value is null, no timing information is displayed.
A trailing newline is added when the format string is displayed.
.TP
.B TMOUT
-If set to a value greater than zero, \fBTMOUT\fP is treated as the
+If set to a value greater than zero,
+.SM
+.B TMOUT
+is treated as the
default timeout for the \fBread\fP builtin.
The \fBselect\fP command terminates if input does not arrive
-after \fBTMOUT\fP seconds when input is coming from a terminal.
+after
+.SM
+.B 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.
.B Bash
@@ -2038,13 +2249,6 @@ below). If set to any other value, the supplied string must
be a prefix of a stopped job's name; this provides functionality
analogous to the \fB%\fP\fIstring\fP job identifier.
.TP
-.B command_not_found_handle
-The name of a shell function to be called if a command cannot be
-found. The return value of this function should be 0, if the command
-is available after execution of the function, otherwise 127 (EX_NOTFOUND).
-Enabled only in interactive, non POSIX mode shells. This is a Debian
-extension.
-.TP
.B histchars
The two or three characters which control history expansion
and tokenization (see
@@ -2066,26 +2270,35 @@ parser to treat the rest of the line as a comment.
.PD
.SS Arrays
.B Bash
-provides one-dimensional array variables. Any variable may be used as
-an array; the
+provides one-dimensional indexed and associative array variables.
+Any variable may be used as an indexed array; the
.B declare
-builtin will explicitly declare an array. There is no maximum
+builtin will explicitly declare an array.
+There is no maximum
limit on the size of an array, nor any requirement that members
-be indexed or assigned contiguously. Arrays are indexed using
-integers and are zero-based.
+be indexed or assigned contiguously.
+Indexed arrays are referenced using integers (including arithmetic
+expressions) and are zero-based; associative arrays are referenced
+using arbitrary strings.
.PP
-An array is created automatically if any variable is assigned to using
-the syntax \fIname\fP[\fIsubscript\fP]=\fIvalue\fP. The
+An indexed array is created automatically if any variable is assigned to
+using the syntax \fIname\fP[\fIsubscript\fP]=\fIvalue\fP. The
.I subscript
is treated as an arithmetic expression that must evaluate to a number
-greater than or equal to zero. To explicitly declare an array, use
+greater than or equal to zero. To explicitly declare an indexed array,
+use
.B declare \-a \fIname\fP
(see
.SM
.B SHELL BUILTIN COMMANDS
below).
.B declare \-a \fIname\fP[\fIsubscript\fP]
-is also accepted; the \fIsubscript\fP is ignored. Attributes may be
+is also accepted; the \fIsubscript\fP is ignored.
+.PP
+Associative arrays are created using
+.BR "declare \-A \fIname\fP" .
+.PP
+Attributes may be
specified for an array variable using the
.B declare
and
@@ -2094,11 +2307,15 @@ builtins. Each attribute applies to all members of an array.
.PP
Arrays are assigned to using compound assignments of the form
\fIname\fP=\fB(\fPvalue\fI1\fP ... value\fIn\fP\fB)\fP, where each
-\fIvalue\fP is of the form [\fIsubscript\fP]=\fIstring\fP. Only
-\fIstring\fP is required. If
-the optional brackets and subscript are supplied, that index is assigned to;
+\fIvalue\fP is of the form [\fIsubscript\fP]=\fIstring\fP.
+Indexed array assignments do not require the bracket and subscript.
+When assigning to indexed arrays, if the optional brackets and subscript
+are supplied, that index is assigned to;
otherwise the index of the element assigned is the last index assigned
to by the statement plus one. Indexing starts at zero.
+.PP
+When assigning to an associative array, the subscript is required.
+.PP
This syntax is also accepted by the
.B declare
builtin. Individual array elements may be assigned to using the
@@ -2129,14 +2346,17 @@ above). ${#\fIname\fP[\fIsubscript\fP]} expands to the length of
${\fIname\fP[\fIsubscript\fP]}. If \fIsubscript\fP is \fB*\fP or
\fB@\fP, the expansion is the number of elements in the array.
Referencing an array variable without a subscript is equivalent to
-referencing element zero.
+referencing the array with a subscript of 0.
+.PP
+An array variable is considered set if a subscript has been assigned a
+value. The null string is a valid value.
.PP
The
.B unset
builtin is used to destroy arrays. \fBunset\fP \fIname\fP[\fIsubscript\fP]
destroys the array element at index \fIsubscript\fP.
-Care must be taken to avoid unwanted side effects caused by filename
-generation.
+Care must be taken to avoid unwanted side effects caused by pathname
+expansion.
\fBunset\fP \fIname\fP, where \fIname\fP is an array, or
\fBunset\fP \fIname\fP[\fIsubscript\fP], where
\fIsubscript\fP is \fB*\fP or \fB@\fP, removes the entire array.
@@ -2148,7 +2368,10 @@ and
.B readonly
builtins each accept a
.B \-a
-option to specify an array. The
+option to specify an indexed array and a
+.B \-A
+option to specify an associative array.
+The
.B read
builtin accepts a
.B \-a
@@ -2209,13 +2432,21 @@ Brace expansions may be nested. The results of each expanded
string are not sorted; left to right order is preserved.
For example, a\fB{\fPd,c,b\fB}\fPe expands into `ade ace abe'.
.PP
-A sequence expression takes the form \fB{\fP\fIx\fP\fB..\fP\fIy\fP\fB}\fP,
-where \fIx\fP and \fIy\fP are either integers or single characters.
+A sequence expression takes the form
+\fB{\fP\fIx\fP\fB..\fP\fIy\fP\fB[..\fP\fIincr\fP\fB]}\fP,
+where \fIx\fP and \fIy\fP are either integers or single characters,
+and \fIincr\fP, an optional increment, is an integer.
When integers are supplied, the expression expands to each number between
\fIx\fP and \fIy\fP, inclusive.
+Supplied integers may be prefixed with \fI0\fP to force each term to have the
+same width. When either \fIx\fP or \fPy\fP begins with a zero, the shell
+attempts to force all generated terms to contain the same number of digits,
+zero-padding where necessary.
When characters are supplied, the expression expands to each character
lexicographically between \fIx\fP and \fIy\fP, inclusive. Note that
both \fIx\fP and \fIy\fP must be of the same type.
+When the increment is supplied, it is used as the difference between
+each term. The default increment is 1 or -1 as appropriate.
.PP
Brace expansion is performed before any other expansions,
and any characters special to other expansions are preserved
@@ -2357,7 +2588,7 @@ is followed by a character which is not to be
interpreted as part of its name.
.PD
.PP
-If the first character of \fIparameter\fP is an exclamation point,
+If the first character of \fIparameter\fP is an exclamation point (\fB!\fP),
a level of variable indirection is introduced.
\fBBash\fP uses the value of the variable formed from the rest of
\fIparameter\fP as the name of the variable; this variable is then
@@ -2371,9 +2602,10 @@ introduce indirection.
.PP
In each of the cases below, \fIword\fP is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
-When not performing substring expansion, \fBbash\fP tests for a parameter
-that is unset or null; omitting the colon results in a test only for a
-parameter that is unset.
+.PP
+When not performing substring expansion, using the forms documented below,
+\fBbash\fP tests for a parameter that is unset or null. Omitting the colon
+results in a test only for a parameter that is unset.
.PP
.PD 0
.TP
@@ -2436,37 +2668,42 @@ below).
\fIlength\fP must evaluate to a number greater than or equal to zero.
If \fIoffset\fP evaluates to a number less than zero, the value
is used as an offset from the end of the value of \fIparameter\fP.
-Arithmetic expressions starting with a - must be separated by whitespace
-from the preceding : to be
-distinguished from the \fBUse Default Values\fP expansion.
If \fIparameter\fP is \fB@\fP, the result is \fIlength\fP positional
parameters beginning at \fIoffset\fP.
-If \fIparameter\fP is an array name indexed by @ or *,
+If \fIparameter\fP is an indexed array name subscripted by @ or *,
the result is the \fIlength\fP
members of the array beginning with ${\fIparameter\fP[\fIoffset\fP]}.
A negative \fIoffset\fP is taken relative to one greater than the maximum
index of the specified array.
+Substring expansion applied to an associative array produces undefined
+results.
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the :- expansion.
Substring indexing is zero-based unless the positional parameters
-are used, in which case the indexing starts at 1.
+are used, in which case the indexing starts at 1 by default.
+If \fIoffset\fP is 0, and the positional parameters are used, \fB$0\fP is
+prefixed to the list.
.TP
${\fB!\fP\fIprefix\fP\fB*\fP}
.PD 0
.TP
${\fB!\fP\fIprefix\fP\fB@\fP}
.PD
+\fBNames matching prefix.\fP
Expands to the names of variables whose names begin with \fIprefix\fP,
separated by the first character of the
.SM
.B IFS
special variable.
+When \fI@\fP is used and the expansion appears within double quotes, each
+variable name expands to a separate word.
.TP
${\fB!\fP\fIname\fP[\fI@\fP]}
.PD 0
.TP
${\fB!\fP\fIname\fP[\fI*\fP]}
.PD
+\fBList of array keys.\fP
If \fIname\fP is an array variable, expands to the list of array indices
(keys) assigned in \fIname\fP.
If \fIname\fP is not an array, expands to 0 if \fIname\fP is set and null
@@ -2475,6 +2712,7 @@ When \fI@\fP is used and the expansion appears within double quotes, each
key expands to a separate word.
.TP
${\fB#\fP\fIparameter\fP}
+\fBParameter length.\fP
The length in characters of the value of \fIparameter\fP is substituted.
If
.I parameter
@@ -2496,6 +2734,7 @@ ${\fIparameter\fP\fB#\fP\fIword\fP}
.TP
${\fIparameter\fP\fB##\fP\fIword\fP}
.PD
+\fBRemove matching prefix pattern.\fP
The
.I word
is expanded to produce a pattern just as in pathname
@@ -2528,6 +2767,7 @@ ${\fIparameter\fP\fB%\fP\fIword\fP}
.TP
${\fIparameter\fP\fB%%\fP\fIword\fP}
.PD
+\fBRemove matching suffix pattern.\fP
The \fIword\fP is expanded to produce a pattern just as in
pathname expansion.
If the pattern matches a trailing portion of the expanded value of
@@ -2554,11 +2794,12 @@ the pattern removal operation is applied to each member of the
array in turn, and the expansion is the resultant list.
.TP
${\fIparameter\fP\fB/\fP\fIpattern\fP\fB/\fP\fIstring\fP}
+\fBPattern substitution.\fP
The \fIpattern\fP is expanded to produce a pattern just as in
pathname expansion.
\fIParameter\fP is expanded and the longest match of \fIpattern\fP
against its value is replaced with \fIstring\fP.
-If \Ipattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
+If \fIpattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
replaced with \fIstring\fP. Normally only the first match is replaced.
If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
of the expanded value of \fIparameter\fP.
@@ -2582,6 +2823,44 @@ or
.BR * ,
the substitution operation is applied to each member of the
array in turn, and the expansion is the resultant list.
+.TP
+${\fIparameter\fP\fB^\fP\fIpattern\fP}
+.PD 0
+.TP
+${\fIparameter\fP\fB^^\fP\fIpattern\fP}
+.TP
+${\fIparameter\fP\fB,\fP\fIpattern\fP}
+.TP
+${\fIparameter\fP\fB,,\fP\fIpattern\fP}
+.PD
+\fBCase modification.\fP
+This expansion modifies the case of alphabetic characters in \fIparameter\fP.
+The \fIpattern\fP is expanded to produce a pattern just as in
+pathname expansion.
+The \fB^\fP operator converts lowercase letters matching \fIpattern\fP
+to uppercase; the \fB,\fP operator converts matching uppercase letters
+to lowercase.
+The \fB^^\fP and \fB,,\fP expansions convert each matched character in the
+expanded value; the \fB^\fP and \fB,\fP expansions match and convert only
+the first character in the expanded value..
+If \fIpattern\fP is omitted, it is treated like a \fB?\fP, which matches
+every character.
+If
+.I parameter
+is
+.B @
+or
+.BR * ,
+the case modification operation is applied to each positional
+parameter in turn, and the expansion is the resultant list.
+If
+.I parameter
+is an array variable subscripted with
+.B @
+or
+.BR * ,
+the case modification operation is applied to each member of the
+array in turn, and the expansion is the resultant list.
.SS Command Substitution
.PP
\fICommand substitution\fP allows the output of a command to replace
@@ -2593,7 +2872,7 @@ the command name. There are two forms:
.RE
or
.RS
-\fB`\fP\fIcommand\fP\fB`\fP
+\fB\`\fP\fIcommand\fP\fB\`\fP
.RE
.PP
.B Bash
@@ -2608,7 +2887,7 @@ the equivalent but faster \fB$(< \fIfile\fP)\fR.
When the old-style backquote form of substitution is used,
backslash retains its literal meaning except when followed by
.BR $ ,
-.BR ` ,
+.BR \` ,
or
.BR \e .
The first backquote not preceded by a backslash terminates the
@@ -2630,9 +2909,6 @@ and the substitution of the result. The format for arithmetic expansion is:
\fB$((\fP\fIexpression\fP\fB))\fP
.RE
.PP
-The old format \fB$[\fP\fIexpression\fP\fB]\fP is deprecated and will
-be removed in upcoming versions of bash.
-.PP
The
.I expression
is treated as if it were within double quotes, but a double quote
@@ -2690,10 +2966,18 @@ is unset, or its
value is exactly
.BR <space><tab><newline> ,
the default, then
+sequences of
+.BR <space> ,
+.BR <tab> ,
+and
+.B <newline>
+at the beginning and end of the results of the previous
+expansions are ignored, and
any sequence of
.SM
.B IFS
-characters serves to delimit words. If
+characters not at the beginning or end serves to delimit words.
+If
.SM
.B IFS
has a value other than the default, then sequences of
@@ -2757,7 +3041,7 @@ file names matching the pattern.
If no matching file names are found,
and the shell option
.B nullglob
-is disabled, the word is left unchanged.
+is not enabled, the word is left unchanged.
If the
.B nullglob
option is set, and no matches are found,
@@ -2770,10 +3054,6 @@ If the shell option
.B nocaseglob
is enabled, the match is performed without regard to the case
of alphabetic characters.
-Note that when using range expressions like
-[a-z] (see below), letters of the other case may be included,
-depending on the setting of
-.B LC_COLLATE.
When a pattern is used for pathname expansion,
the character
.B ``.''
@@ -2855,6 +3135,12 @@ The special pattern characters have the following meanings:
.TP
.B *
Matches any string, including the null string.
+When the \fBglobstar\fP shell option is enabled, and \fB*\fP is used in
+a pathname expansion context, two adjacent \fB*\fPs used as a single
+pattern will match all files and zero or more directories and
+subdirectories.
+If followed by a \fB/\fP, two adjacent \fB*\fPs will match only directories
+and subdirectories.
.TP
.B ?
Matches any single character.
@@ -2873,7 +3159,10 @@ or a
.B ^
then any character not enclosed is matched.
The sorting order of characters in range expressions is determined by
-the current locale and the value of the \fBLC_COLLATE\fP shell variable,
+the current locale and the value of the
+.SM
+.B LC_COLLATE
+shell variable,
if set.
A
.B \-
@@ -2972,6 +3261,14 @@ or may follow a
Redirections are processed in the order they appear, from
left to right.
.PP
+Each redirection that may be preceded by a file descriptor number
+may instead be preceded by a word of the form {\fIvarname\fP}.
+In this case, for each redirection operator except
+>&- and <&-, the shell will allocate a file descriptor greater
+than 10 and assign it to \fIvarname\fP. If >&- or <&- is preceded
+by {\fIvarname\fP}, the value of \fIvarname\fP defines the file
+descriptor to close.
+.PP
In the following descriptions, if the file descriptor number is
omitted, and the first character of the redirection operator is
.BR < ,
@@ -3006,7 +3303,7 @@ ls 2\fB>&\fP1 \fB>\fP dirlist
.PP
directs only the standard output to file
.IR dirlist ,
-because the standard error was duplicated as standard output
+because the standard error was duplicated from the standard output
before the standard output was redirected to
.IR dirlist .
.PP
@@ -3040,9 +3337,6 @@ a UDP connection to the corresponding socket.
.PD
.RE
.PP
-\fBNOTE:\fP Bash, as packaged for Debian, does \fBnot\fP support using
-the \fB/dev/tcp\fP and \fB/dev/udp\fP files.
-.PP
A failure to open or create a file causes the redirection to fail.
.PP
Redirections using file descriptors greater than 9 should be used with
@@ -3121,14 +3415,12 @@ The general format for appending output is:
.PP
.SS Redirecting Standard Output and Standard Error
.PP
-.B Bash
-allows both the
+This construct allows both the
standard output (file descriptor 1) and
the standard error output (file descriptor 2)
to be redirected to the file whose name is the
expansion of
-.I word
-with this construct.
+.IR word .
.PP
There are two formats for redirecting standard output and
standard error:
@@ -3147,11 +3439,32 @@ This is semantically equivalent to
.PP
\fB>\fP\fIword\fP 2\fB>&\fP1
.RE
+.PP
+.SS Appending Standard Output and Standard Error
+.PP
+This construct allows both the
+standard output (file descriptor 1) and
+the standard error output (file descriptor 2)
+to be appended to the file whose name is the
+expansion of
+.IR word .
+.PP
+The format for appending standard output and standard error is:
+.RS
+.PP
+\fB&>>\fP\fIword\fP
+.RE
+.PP
+This is semantically equivalent to
+.RS
+.PP
+\fB>>\fP\fIword\fP 2\fB>&\fP1
+.RE
.SS Here Documents
.PP
This type of redirection instructs the shell to read input from the
current source until a line containing only
-.I word
+.I delimiter
(with no trailing blanks)
is seen. All of
the lines read up to that point are then used as the standard
@@ -3188,7 +3501,7 @@ must be used to quote the characters
.BR \e ,
.BR $ ,
and
-.BR ` .
+.BR \` .
.PP
If the redirection operator is
.BR <<\- ,
@@ -3302,7 +3615,7 @@ below).
The first word of each simple command, if unquoted,
is checked to see if it has an
alias. If so, that word is replaced by the text of the alias.
-The characters \fB/\fP, \fB$\fP, \fB`\fP, and \fB=\fP and
+The characters \fB/\fP, \fB$\fP, \fB\`\fP, and \fB=\fP and
any of the shell \fImetacharacters\fP or quoting characters
listed above may not appear in an alias name.
The replacement text may contain any valid shell input,
@@ -3391,9 +3704,10 @@ The first element of the
.B FUNCNAME
variable is set to the name of the function while the function
is executing.
+.PP
All other aspects of the shell execution
environment are identical between a function and its caller
-with the exception that the
+with these exceptions: the
.SM
.B DEBUG
and
@@ -3410,7 +3724,12 @@ below) are not inherited unless the function has been given the
builtin below) or the
\fB\-o functrace\fP shell option has been enabled with
the \fBset\fP builtin
-(in which case all functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps).
+(in which case all functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps),
+and the
+.SM
+.B ERR
+trap is not inherited unless the \fB\-o errtrace\fP shell option has
+been enabled.
.PP
Variables local to the function may be declared with the
.B local
@@ -3572,10 +3891,10 @@ descriptor 0, 1, or 2, respectively, is checked.
.PP
Unless otherwise specified, primaries that operate on files follow symbolic
links and operate on the target of the link, rather than the link itself.
-.PP
-See the description of the \fItest\fP builtin command (section SHELL
-BUILTIN COMMANDS below) for the handling of parameters (i.e.
-missing parameters).
+.if t .sp 0.5
+.if n .sp 1
+When used with \fB[[\fP, The \fB<\fP and \fB>\fP operators sort
+lexicographically using the current locale.
.sp 1
.PD 0
.TP
@@ -3679,19 +3998,21 @@ True if the length of
is non-zero.
.TP
\fIstring1\fP \fB==\fP \fIstring2\fP
-True if the strings are equal. \fB=\fP may be used in place of
-\fB==\fP for strict POSIX compliance.
+.PD 0
+.TP
+\fIstring1\fP \fB=\fP \fIstring2\fP
+.PD
+True if the strings are equal. \fB=\fP should be used
+with the \fBtest\fP command for POSIX conformance.
.TP
\fIstring1\fP \fB!=\fP \fIstring2\fP
True if the strings are not equal.
.TP
\fIstring1\fP \fB<\fP \fIstring2\fP
-True if \fIstring1\fP sorts before \fIstring2\fP lexicographically
-in the current locale.
+True if \fIstring1\fP sorts before \fIstring2\fP lexicographically.
.TP
\fIstring1\fP \fB>\fP \fIstring2\fP
-True if \fIstring1\fP sorts after \fIstring2\fP lexicographically
-in the current locale.
+True if \fIstring1\fP sorts after \fIstring2\fP lexicographically.
.TP
.I \fIarg1\fP \fBOP\fP \fIarg2\fP
.SM
@@ -3781,7 +4102,12 @@ A full search of the directories in
.SM
.B PATH
is performed only if the command is not found in the hash table.
-If the search is unsuccessful, the shell prints an error
+If the search is unsuccessful, the shell searches for a defined shell
+function named \fBcommand_not_found_handle\fP.
+If that function exists, it is invoked with the original command and
+the original command's arguments as its arguments, and the function's
+exit status becomes the exit status of the shell.
+If that function is not defined, the shell prints an error
message and returns an exit status of 127.
.PP
If the search is successful, or if the command name contains
@@ -3817,7 +4143,7 @@ arguments, if any.
.SH COMMAND EXECUTION ENVIRONMENT
The shell has an \fIexecution environment\fP, which consists of the
following:
-.sp 1
+.if n .sp 1
.IP \(bu
open files inherited by the shell at invocation, as modified by
redirections supplied to the \fBexec\fP builtin
@@ -3844,14 +4170,16 @@ options enabled by \fBshopt\fP
shell aliases defined with \fBalias\fP
.IP \(bu
various process IDs, including those of background jobs, the value
-of \fB$$\fP, and the value of \fB$PPID\fP
+of \fB$$\fP, and the value of
+.SM
+.B PPID
.PP
When a simple command other than a builtin or shell function
is to be executed, it
is invoked in a separate execution environment that consists of
the following. Unless otherwise noted, the values are inherited
from the shell.
-.sp 1
+.if n .sp 1
.IP \(bu
the shell's open files, plus any modifications and additions specified
by redirections to the command
@@ -3878,6 +4206,10 @@ commands that are invoked as part of a pipeline are also executed in a
subshell environment. Changes made to the subshell environment
cannot affect the shell's execution environment.
.PP
+Subshells spawned to execute command substitutions inherit the value of
+the \fB\-e\fP option from the parent shell. When not in posix mode,
+Bash clears the \fB\-e\fP option in such subshells.
+.PP
If a command is followed by a \fB&\fP and job control is not active, the
default standard input for the command is the empty file \fI/dev/null\fP.
Otherwise, the invoked command inherits the file descriptors of the calling
@@ -3939,6 +4271,15 @@ invokes an external command, the variable
is set to the full file name of the command and passed to that
command in its environment.
.SH "EXIT STATUS"
+.PP
+The exit status of an executed command is the value returned by the
+\fIwaitpid\fP system call or equivalent function. Exit statuses
+fall between 0 and 255, though, as explained below, the shell may
+use values above 125 specially. Exit statuses from shell builtins and
+compound commands are also limited to this range. Under certain
+circumstances, the shell will use special values to indicate specific
+failure modes.
+.PP
For the shell's purposes, a command which exits with a
zero exit status has succeeded. An exit status of zero
indicates success. A non-zero exit status indicates failure.
@@ -4054,7 +4395,7 @@ refers to the ability to selectively stop (\fIsuspend\fP)
the execution of processes and continue (\fIresume\fP)
their execution at a later point. A user typically employs
this facility via an interactive interface supplied jointly
-by the system's terminal driver and
+by the operating system kernel's terminal driver and
.BR bash .
.PP
The shell associates a
@@ -4092,12 +4433,15 @@ These processes are said to be in the
.I Background
processes are those whose process group ID differs from the terminal's;
such processes are immune to keyboard-generated signals.
-Only foreground processes are allowed to read from or write to the
-terminal. Background processes which attempt to read from (write to) the
+Only foreground processes are allowed to read from or, if the
+user so specifies with \f(CWstty tostop\fP, write to the
+terminal.
+Background processes which attempt to read from (write to when
+\f(CWstty tostop\fP is in effect) the
terminal are sent a
.SM
.B SIGTTIN (SIGTTOU)
-signal by the terminal driver,
+signal by the kernel's terminal driver,
which, unless caught, suspends the process.
.PP
If the operating system on which
@@ -4135,7 +4479,7 @@ and typeahead to be discarded.
There are a number of ways to refer to a job in the shell.
The character
.B %
-introduces a job name. Job number
+introduces a job specification (\fIjobspec\fP). Job number
.I n
may be referred to as
.BR %n .
@@ -4165,6 +4509,8 @@ The
.I "previous job"
may be referenced using
.BR %\- .
+If there is only a single job, \fB%+\fP and \fB%\-\fP can both be used
+to refer to that job.
In output pertaining to jobs (e.g., the output of the
.B jobs
command), the current job is always flagged with a
@@ -4205,11 +4551,15 @@ is executed for each child that exits.
.PP
If an attempt to exit
.B bash
-is made while jobs are stopped, the shell prints a warning message. The
+is made while jobs are stopped (or, if the \fBcheckjobs\fP shell option has
+been enabled using the \fBshopt\fP builtin, running), the shell prints a
+warning message, and, if the \fBcheckjobs\fP option is enabled, lists the
+jobs and their statuses.
+The
.B jobs
-command may then be used to inspect their status.
+command may then be used to inspect their status.
If a second attempt to exit is made without an intervening command,
-the shell does not print another warning, and the stopped
+the shell does not print another warning, and any stopped
jobs are terminated.
.SH PROMPTING
When executing interactively,
@@ -4286,10 +4636,19 @@ the version of \fBbash\fP (e.g., 2.00)
the release of \fBbash\fP, version + patch level (e.g., 2.00.0)
.TP
.B \ew
-the current working directory, with \fB$HOME\fP abbreviated with a tilde
+the current working directory, with
+.SM
+.B $HOME
+abbreviated with a tilde
+(uses the value of the
+.SM
+.B PROMPT_DIRTRIM
+variable)
.TP
.B \eW
-the basename of the current working directory, with \fB$HOME\fP
+the basename of the current working directory, with
+.SM
+.B $HOME
abbreviated with a tilde
.TP
.B \e!
@@ -4342,18 +4701,27 @@ This is the library that handles reading input when using an interactive
shell, unless the
.B \-\-noediting
option is given at shell invocation.
+Line editing is also used when using the \fB\-e\fP option to the
+\fBread\fP builtin.
By default, the line editing commands are similar to those of emacs.
A vi-style line editing interface is also available.
-To turn off line editing after the shell is running, use the
-.B +o emacs
+Line editing can be enabled at any time using the
+.B \-o emacs
or
-.B +o vi
+.B \-o vi
options to the
.B set
builtin (see
.SM
.B SHELL BUILTIN COMMANDS
below).
+To turn off line editing after the shell is running, use the
+.B +o emacs
+or
+.B +o vi
+options to the
+.B set
+builtin.
.SS "Readline Notation"
.PP
In this section, the emacs-style notation is used to denote
@@ -4644,6 +5012,12 @@ in vi command mode.
If set to \fBOn\fP, readline performs filename matching and completion
in a case\-insensitive fashion.
.TP
+.B completion\-prefix\-display\-length (0)
+The length in characters of the common prefix of a list of possible
+completions that is displayed without modification. When set to a
+value greater than zero, common prefixes longer than this value are
+replaced with an ellipsis when displaying possible completions.
+.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
the number of possible completions
@@ -4674,11 +5048,21 @@ can be set to either
or
.BR vi .
.TP
+.B echo\-control\-characters (On)
+When set to \fBOn\fP, on operating systems that indicate they support it,
+readline echoes a character corresponding to a signal generated from the
+keyboard.
+.TP
.B enable\-keypad (Off)
When set to \fBOn\fP, readline will try to enable the application
keypad when it is called. Some systems need this to enable the
arrow keys.
.TP
+.B enable\-meta\-key (On)
+When set to \fBOn\fP, readline will try to enable any meta modifier
+key the terminal claims to support when it is called. On many terminals,
+the meta key is used to send eight-bit characters.
+.TP
.B expand\-tilde (Off)
If set to \fBon\fP, tilde expansion is performed when readline
attempts word completion.
@@ -4688,6 +5072,10 @@ If set to \fBon\fP, the history code attempts to place point at the
same location on each history line retrieved with \fBprevious-history\fP
or \fBnext-history\fP.
.TP
+.B history\-size (0)
+Set the maximum number of history entries saved in the history list. If
+set to zero, the number of entries in the history list is not limited.
+.TP
.B horizontal\-scroll\-mode (Off)
When set to \fBOn\fP, makes readline use a single line for display,
scrolling the input horizontally on a single screen line when it
@@ -4749,6 +5137,12 @@ to display a screenful of possible completions at a time.
.B print\-completions\-horizontally (Off)
If set to \fBOn\fP, readline will display completions with matches
sorted horizontally in alphabetical order, rather than down the screen.
+.TP
+.B revert\-all\-at\-newline (Off)
+If set to \fBon\fP, readline will undo all changes to history lines
+before returning when \fBaccept\-line\fP is executed. By default,
+history lines may be modified and retain individual undo lists across
+calls to \fBreadline\fP.
.TP
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
@@ -4767,6 +5161,14 @@ possible partial completion (the possible completions don't share
a common prefix) cause the matches to be listed immediately instead
of ringing the bell.
.TP
+.B skip\-completed\-text (Off)
+If set to \fBOn\fP, this alters the default completion behavior when
+inserting a single match into the line. It's only active when
+performing completion in the middle of a word. If enabled, readline
+does not insert characters from the completion that match characters
+after point in the word being completed, so portions of the word
+following the cursor are not duplicated.
+.TP
.B visible\-stats (Off)
If set to \fBOn\fP, a character denoting a file's type as reported
by \fIstat\fP(2) is appended to the filename when listing possible
@@ -4913,8 +5315,16 @@ Move forward to the end of the next word. Words are composed of
alphanumeric characters (letters and digits).
.TP
.B backward\-word (M\-b)
-Move back to the start of the current or previous word. Words are
-composed of alphanumeric characters (letters and digits).
+Move back to the start of the current or previous word.
+Words are composed of alphanumeric characters (letters and digits).
+.TP
+.B shell\-forward\-word
+Move forward to the end of the next word.
+Words are delimited by non-quoted shell metacharacters.
+.TP
+.B shell\-backward\-word
+Move back to the start of the current or previous word.
+Words are delimited by non-quoted shell metacharacters.
.TP
.B clear\-screen (C\-l)
Clear the screen leaving the current line at the top of the screen.
@@ -5043,7 +5453,7 @@ Invoke an editor on the current command line, and execute the result as shell
commands.
\fBBash\fP attempts to invoke
.SM
-.BR $FCEDIT ,
+.BR $VISUAL ,
.SM
.BR $EDITOR ,
and \fIemacs\fP as the editor, in that order.
@@ -5142,6 +5552,15 @@ Word boundaries are the same as those used by \fBforward\-word\fP.
Kill the word behind point.
Word boundaries are the same as those used by \fBbackward\-word\fP.
.TP
+.B shell\-kill\-word (M\-d)
+Kill from point to the end of the current word, or if between
+words, to the end of the next word.
+Word boundaries are the same as those used by \fBshell\-forward\-word\fP.
+.TP
+.B shell\-backward\-kill\-word (M\-Rubout)
+Kill the word behind point.
+Word boundaries are the same as those used by \fBshell\-backward\-word\fP.
+.TP
.B unix\-word\-rubout (C\-w)
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
@@ -5234,6 +5653,11 @@ through the list.
This command is intended to be bound to \fBTAB\fP, but is unbound
by default.
.TP
+.B menu\-complete-\backward
+Identical to \fBmenu\-complete\fP, but moves backward through the list
+of possible completions, as if \fBmenu\-complete\fP had been given a
+negative argument. This command is unbound by default.
+.TP
.B delete\-char\-or\-list
Deletes the character under the cursor if not at the beginning or
end of the line (like \fBdelete\-char\fP).
@@ -5288,6 +5712,11 @@ Attempt completion on the text before point, comparing
the text against lines from the history list for possible
completion matches.
.TP
+.B dabbrev\-expand
+Attempt menu completion on the text before point, comparing
+the text against lines from the history list for possible
+completion matches.
+.TP
.B complete\-into\-braces (M\-{)
Perform filename completion and insert the list of possible completions
enclosed within braces so the list is available to the shell (see
@@ -5361,6 +5790,15 @@ character. A negative count searches for previous occurrences.
A character is read and point is moved to the previous occurrence of that
character. A negative count searches for subsequent occurrences.
.TP
+.B skip\-csi\-sequence ()
+Read enough characters to consume a multi-key sequence such as those
+defined for keys like Home and End. Such sequences begin with a
+Control Sequence Indicator (CSI), usually ESC\-[. If this sequence is
+bound to "\e[", keys producing such sequences will have no effect
+unless explicitly bound to a readline command, instead of inserting
+stray characters into the editing buffer. This is unbound by default,
+but usually bound to ESC\-[.
+.TP
.B insert\-comment (M\-#)
Without a numeric argument, the value of the readline
.B comment\-begin
@@ -5368,7 +5806,7 @@ variable is inserted at the beginning of the current line.
If a numeric argument is supplied, this command acts as a toggle: if
the characters at the beginning of the line do not match the value
of \fBcomment\-begin\fP, the value is inserted, otherwise
-the characters in \fBcomment-begin\fP are deleted from the beginning of
+the characters in \fBcomment\-begin\fP are deleted from the beginning of
the line.
In either case, the line is accepted as if a newline had been typed.
The default value of
@@ -5427,12 +5865,17 @@ using the \fBcomplete\fP builtin (see
below), the programmable completion facilities are invoked.
.PP
First, the command name is identified.
+If the command word is the empty string (completion attempted at the
+beginning of an empty line), any compspec defined with
+the \fB\-E\fP option to \fBcomplete\fP is used.
If a compspec has been defined for that command, the
compspec is used to generate the list of possible completions for the word.
If the command word is a full pathname, a compspec for the full
pathname is searched for first.
If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
+If those searches to not result in a compspec, any compspec defined with
+the \fB\-D\fP option to \fBcomplete\fP is used as the default.
.PP
Once a compspec has been found, it is used to generate the list of
matching words.
@@ -5452,7 +5895,7 @@ variable
.B FIGNORE
is used to filter the matches.
.PP
-Any completions specified by a filename expansion pattern to the
+Any completions specified by a pathname expansion pattern to the
\fB\-G\fP option are generated next.
The words generated by the pattern need not match the word
being completed.
@@ -5486,10 +5929,14 @@ After these matches have been generated, any shell function or command
specified with the \fB\-F\fP and \fB\-C\fP options is invoked.
When the command or function is invoked, the
.SM
-.B COMP_LINE
+.BR COMP_LINE ,
+.SM
+.BR COMP_POINT ,
+.SM
+.BR COMP_KEY ,
and
.SM
-.B COMP_POINT
+.B COMP_TYPE
variables are assigned values as described above under
\fBShell Variables\fP.
If a shell function is being invoked, the
@@ -5561,6 +6008,35 @@ the programmable completion functions force readline to append a slash
to completed names which are symbolic links to directories, subject to
the value of the \fBmark\-directories\fP readline variable, regardless
of the setting of the \fBmark-symlinked\-directories\fP readline variable.
+.PP
+There is some support for dynamically modifying completions. This is
+most useful when used in combination with a default completion specified
+with \fBcomplete -D\fP.
+It's possible for shell functions executed as completion
+handlers to indicate that completion should be retried by returning an
+exit status of 124. If a shell function returns 124, and changes
+the compspec associated with the command on which completion is being
+attempted (supplied as the first argument when the function is executed),
+programmable completion restarts from the beginning, with an
+attempt to find a compspec for that command. This allows a set of
+completions to be built dynamically as completion is attempted, rather than
+being loaded all at once.
+.PP
+For instance, assuming that there is a library of compspecs, each kept in a
+file corresponding to the name of the command, the following default
+completion function would load completions dynamically:
+.PP
+\f(CW_completion_loader()
+.br
+{
+.br
+ . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
+.br
+}
+.br
+complete -D -F _completion_loader
+.br
+\fP
.SH HISTORY
When the
.B \-o history
@@ -5569,7 +6045,10 @@ option to the
builtin is enabled, the shell provides access to the
\fIcommand history\fP,
the list of commands previously typed.
-The value of the \fBHISTSIZE\fP variable is used as the
+The value of the
+.SM
+.B HISTSIZE
+variable is used as the
number of commands to save in a history list.
The text of the last
.SM
@@ -5599,6 +6078,13 @@ is truncated, if necessary, to contain no more than
the number of lines specified by the value of
.SM
.BR HISTFILESIZE .
+When the history file is read,
+lines beginning with the history comment character followed immediately
+by a digit are interpreted as timestamps for the preceding history line.
+These timestamps are optionally displayed depending on the value of the
+.SM
+.B HISTTIMEFORMAT
+variable.
When an interactive shell exits, the last
.SM
.B $HISTSIZE
@@ -5619,7 +6105,16 @@ If
.SM
.B HISTFILE
is unset, or if the history file is unwritable, the history is
-not saved. After saving the history, the history file is truncated
+not saved.
+If the
+.SM
+.B HISTTIMEFORMAT
+variable is set, time stamps are written to the history file, marked
+with the history comment character, so
+they may be preserved across shell sessions.
+This uses the history comment character to distinguish timestamps from
+other history lines.
+After saving the history, the history file is truncated
to contain no more than
.SM
.B HISTFILESIZE
@@ -5719,7 +6214,7 @@ If the
.B histverify
shell option is enabled (see the description of the
.B shopt
-builtin), and
+builtin below), and
.B readline
is being used, history substitutions are not immediately passed to
the shell parser.
@@ -5753,6 +6248,9 @@ history expansion mechanism (see the description of
.B histchars
above under
.BR "Shell Variables" ).
+The shell uses
+the history comment character to mark history timestamps when
+writing the history file.
.SS Event Designators
.PP
An event designator is a reference to a command line entry in the
@@ -5940,8 +6438,14 @@ section as accepting options preceded by
accepts
.B \-\-
to signify the end of the options.
-For example, the \fB:\fP, \fBtrue\fP, \fBfalse\fP, and \fBtest\fP builtins
-do not accept options.
+The \fB:\fP, \fBtrue\fP, \fBfalse\fP, and \fBtest\fP builtins
+do not accept options and do not treat \fB\-\-\fP specially.
+The \fBexit\fP, \fBlogout\fP, \fBbreak\fP, \fBcontinue\fP, \fBlet\fP,
+and \fBshift\fP builtins accept and process arguments beginning with
+\fB\-\fP without requiring \fB\-\-\fP.
+Other builtins that accept arguments but are not specified as accepting
+options interpret arguments beginning with \fB\-\fP as invalid options and
+require \fB\-\-\fP to prevent this interpretation.
.sp .5
.PD 0
.TP
@@ -6012,8 +6516,9 @@ no alias has been defined.
Resume each suspended job \fIjobspec\fP in the background, as if it
had been started with
.BR & .
-If \fIjobspec\fP is not present, the shell's notion of the
-\fIcurrent job\fP is used.
+If
+.I jobspec
+is not present, the shell's notion of the \fIcurrent job\fP is used.
.B bg
.I jobspec
returns 0 unless run when job control is disabled or, when run with
@@ -6071,13 +6576,6 @@ that they can be re-read.
.B \-P
List current \fBreadline\fP function names and bindings.
.TP
-.B \-v
-Display \fBreadline\fP variable names and values in such a way that they
-can be re-read.
-.TP
-.B \-V
-List current \fBreadline\fP variable names and values.
-.TP
.B \-s
Display \fBreadline\fP key sequences bound to macros and the strings
they output in such a way that they can be re-read.
@@ -6086,6 +6584,13 @@ they output in such a way that they can be re-read.
Display \fBreadline\fP key sequences bound to macros and the strings
they output.
.TP
+.B \-v
+Display \fBreadline\fP variable names and values in such a way that they
+can be re-read.
+.TP
+.B \-V
+List current \fBreadline\fP variable names and values.
+.TP
.B \-f \fIfilename\fP
Read key bindings from \fIfilename\fP.
.TP
@@ -6101,6 +6606,20 @@ Remove any current binding for \fIkeyseq\fP.
.B \-x \fIkeyseq\fP:\fIshell\-command\fP
Cause \fIshell\-command\fP to be executed whenever \fIkeyseq\fP is
entered.
+When \fIshell\-command\fP is executed, the shell sets the
+.SM
+.B READLINE_LINE
+variable to the contents of the \fBreadline\fP line buffer and the
+.SM
+.B READLINE_POINT
+variable to the current location of the insertion point.
+If the executed command changes the value of
+.SM
+.B READLINE_LINE
+or
+.SM
+.BR READLINE_POINT ,
+those new values will be reflected in the editing state.
.PD
.PP
The return value is 0 unless an unrecognized option is given or an
@@ -6119,10 +6638,8 @@ loop. If \fIn\fP is specified, break \fIn\fP levels.
must be \(>= 1. If
.I n
is greater than the number of enclosing loops, all enclosing loops
-are exited. The return value is 0 unless the shell is not executing
-a loop when
-.B break
-is executed.
+are exited.
+The return value is 0 unless \fIn\fP is not greater than or equal to 1.
.TP
\fBbuiltin\fP \fIshell\-builtin\fP [\fIarguments\fP]
Execute the specified shell builtin, passing it
@@ -6136,6 +6653,20 @@ The return status is false if
.I shell\-builtin
is not a shell builtin command.
.TP
+\fBcaller\fP [\fIexpr\fP]
+Returns the context of any active subroutine call (a shell function or
+a script executed with the \fB.\fP or \fBsource\fP builtins.
+Without \fIexpr\fP, \fBcaller\fP displays the line number and source
+filename of the current subroutine call.
+If a non-negative integer is supplied as \fIexpr\fP, \fBcaller\fP
+displays the line number, subroutine name, and source file corresponding
+to that position in the current execution call stack. This extra
+information may be used, for example, to print a stack trace. The
+current frame is frame 0.
+The return value is 0 unless the shell is not executing a subroutine
+call or \fIexpr\fP does not correspond to a valid position in the
+call stack.
+.TP
\fBcd\fP [\fB\-L|-P\fP] [\fIdir\fP]
Change the current directory to \fIdir\fP. The variable
.SM
@@ -6174,27 +6705,16 @@ option forces symbolic links to be followed. An argument of
is equivalent to
.SM
.BR $OLDPWD .
-If a non-empty directory name from \fBCDPATH\fP is used, or if
+If a non-empty directory name from
+.SM
+.B CDPATH
+is used, or if
\fB\-\fP is the first argument, and the directory change is
successful, the absolute pathname of the new working directory is
written to the standard output.
The return value is true if the directory was successfully changed;
false otherwise.
.TP
-\fBcaller\fP [\fIexpr\fP]
-Returns the context of any active subroutine call (a shell function or
-a script executed with the \fB.\fP or \fBsource\fP builtins.
-Without \fIexpr\fP, \fBcaller\fP displays the line number and source
-filename of the current subroutine call.
-If a non-negative integer is supplied as \fIexpr\fP, \fBcaller\fP
-displays the line number, subroutine name, and source file corresponding
-to that position in the current execution call stack. This extra
-information may be used, for example, to print a stack trace. The
-current frame is frame 0.
-The return value is 0 unless the shell is not executing a subroutine
-call or \fIexpr\fP does not correspond to a valid position in the
-call stack.
-.TP
\fBcommand\fP [\fB\-pVv\fP] \fIcommand\fP [\fIarg\fP ...]
Run
.I command
@@ -6209,6 +6729,7 @@ are executed. If the
option is given, the search for
.I command
is performed using a default value for
+.SM
.B PATH
that is guaranteed to find all of the standard utilities.
If either the
@@ -6258,12 +6779,12 @@ will be displayed.
The return value is true unless an invalid option is supplied, or no
matches were generated.
.TP
-\fBcomplete\fP [\fB\-abcdefgjksuv\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP]
+\fBcomplete\fP [\fB\-abcdefgjksuv\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-DE\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP]
.br
-[\fB\-X\fP \fIfilterpat\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP] \fIname\fP [\fIname ...\fP]
+[\fB\-X\fP \fIfilterpat\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP] \fIname\fP [\fIname ...\fP]
.PD 0
.TP
-\fBcomplete\fP \fB\-pr\fP [\fIname\fP ...]
+\fBcomplete\fP \fB\-pr\fP [\fB\-DE\fP] [\fIname\fP ...]
.PD
Specify how arguments to each \fIname\fP should be completed.
If the \fB\-p\fP option is supplied, or if no options are supplied,
@@ -6272,6 +6793,12 @@ them to be reused as input.
The \fB\-r\fP option removes a completion specification for
each \fIname\fP, or, if no \fIname\fPs are supplied, all
completion specifications.
+The \fB\-D\fP option indicates that the remaining options and actions should
+apply to the ``default'' command completion; that is, completion attempted
+on a command for which no completion has previously been defined.
+The \fB\-E\fP option indicates that the remaining options and actions should
+apply to ``empty'' command completion; that is, completion attempted on a
+blank line.
.sp 1
The process of applying these completion specifications when word completion
is attempted is described above under \fBProgrammable Completion\fP.
@@ -6304,8 +6831,9 @@ Perform directory name completion if the compspec generates no matches.
.TP 8
.B filenames
Tell readline that the compspec generates filenames, so it can perform any
-filename\-specific processing (like adding a slash to directory names or
-suppressing trailing spaces). Intended to be used with shell functions.
+filename\-specific processing (like adding a slash to directory names,
+quoting special characters, or suppressing trailing spaces).
+Intended to be used with shell functions.
.TP 8
.B nospace
Tell readline not to append a space (the default) to words completed at
@@ -6399,7 +6927,7 @@ Names of all shell variables. May also be specified as \fB\-v\fP.
.RE
.TP 8
\fB\-G\fP \fIglobpat\fP
-The filename expansion pattern \fIglobpat\fP is expanded to generate
+The pathname expansion pattern \fIglobpat\fP is expanded to generate
the possible completions.
.TP 8
\fB\-W\fP \fIwordlist\fP
@@ -6424,7 +6952,7 @@ of the
array variable.
.TP 8
\fB\-X\fP \fIfilterpat\fP
-\fIfilterpat\fP is a pattern as used for filename expansion.
+\fIfilterpat\fP is a pattern as used for pathname expansion.
It is applied to the list of possible completions generated by the
preceding options and arguments, and each completion matching
\fIfilterpat\fP is removed from the list.
@@ -6447,6 +6975,25 @@ a \fIname\fP for which no specification exists, or
an error occurs adding a completion specification.
.RE
.TP
+\fBcompopt\fP [\fB\-o\fP \fIoption\fP] [\fB\-DE\fP] [\fB+o\fP \fIoption\fP] [\fIname\fP]
+Modify completion options for each \fIname\fP according to the
+\fIoption\fPs, or for the
+currently-execution completion if no \fIname\fPs are supplied.
+If no \fIoption\fPs are given, display the completion options for each
+\fIname\fP or the current completion.
+The possible values of \fIoption\fP are those valid for the \fBcomplete\fP
+builtin described above.
+The \fB\-D\fP option indicates that the remaining options should
+apply to the ``default'' command completion; that is, completion attempted
+on a command for which no completion has previously been defined.
+The \fB\-E\fP option indicates that the remaining options should
+apply to ``empty'' command completion; that is, completion attempted on a
+blank line.
+.PP
+The return value is true unless an invalid option is supplied, an attempt
+is made to modify the options for a \fIname\fP for which no completion
+specification exists, or an output error occurs.
+.TP
\fBcontinue\fP [\fIn\fP]
Resume the next iteration of the enclosing
.BR for ,
@@ -6462,15 +7009,13 @@ is specified, resume at the \fIn\fPth enclosing loop.
must be \(>= 1. If
.I n
is greater than the number of enclosing loops, the last enclosing loop
-(the ``top-level'' loop) is resumed. The return value is 0 unless the
-shell is not executing a loop when
-.B continue
-is executed.
+(the ``top-level'' loop) is resumed.
+The return value is 0 unless \fIn\fP is not greater than or equal to 1.
.TP
-\fBdeclare\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
+\fBdeclare\fP [\fB\-aAfFilrtux\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
.PD 0
.TP
-\fBtypeset\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
+\fBtypeset\fP [\fB\-aAfFilrtux\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
.PD
Declare variables and/or give them attributes.
If no \fIname\fPs are given then display the values of variables.
@@ -6480,7 +7025,15 @@ option will display the attributes and values of each
.IR name .
When
.B \-p
-is used, additional options are ignored.
+is used with \fIname\fP arguments, additional options are ignored.
+When
+.B \-p
+is supplied without \fIname\fP arguments, it will display the attributes
+and values of all variables having the attributes specified by the
+additional options.
+If no other options are supplied with \fB\-p\fP, \fBdeclare\fP will display
+the attributes and values of all shell variables. The \fB\-f\fP option
+will restrict the display to shell functions.
The
.B \-F
option inhibits the display of function definitions; only the
@@ -6498,7 +7051,12 @@ to give variables attributes:
.PD 0
.TP
.B \-a
-Each \fIname\fP is an array variable (see
+Each \fIname\fP is an indexed array variable (see
+.B Arrays
+above).
+.TP
+.B \-A
+Each \fIname\fP is an associative array variable (see
.B Arrays
above).
.TP
@@ -6508,8 +7066,13 @@ Use function names only.
.B \-i
The variable is treated as an integer; arithmetic evaluation (see
.SM
-.B "ARITHMETIC EVALUATION" ") "
-is performed when the variable is assigned a value.
+.B "ARITHMETIC EVALUATION"
+above) is performed when the variable is assigned a value.
+.TP
+.B \-l
+When the variable is assigned a value, all upper-case characters are
+converted to lower-case.
+The upper-case attribute is disabled.
.TP
.B \-r
Make \fIname\fPs readonly. These names cannot then be assigned values
@@ -6521,13 +7084,21 @@ Traced functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps from
the calling shell.
The trace attribute has no special meaning for variables.
.TP
+.B \-u
+When the variable is assigned a value, all lower-case characters are
+converted to upper-case.
+The lower-case attribute is disabled.
+.TP
.B \-x
Mark \fIname\fPs for export to subsequent commands via the environment.
.PD
.PP
Using `+' instead of `\-'
-turns off the attribute instead, with the exception that \fB+a\fP
-may not be used to destroy an array variable. When used in a function,
+turns off the attribute instead,
+with the exceptions that \fB+a\fP
+may not be used to destroy an array variable and \fB+r\fP will not
+remove the readonly attribute.
+When used in a function,
makes each
\fIname\fP local, as with the
.B local
@@ -6548,7 +7119,7 @@ an attempt is made to turn off array status for an array variable,
or an attempt is made to display a non-existent function with \fB\-f\fP.
.RE
.TP
-.B dirs [\fB\-clpv\fP] [+\fIn\fP] [\-\fIn\fP]
+.B dirs [+\fIn\fP] [\-\fIn\fP] [\fB\-cplv\fP]
Without options, displays the list of currently remembered directories.
The default display is on a single line with directory names separated
by spaces.
@@ -6596,6 +7167,10 @@ of the directory stack.
Without options, each
.I jobspec
is removed from the table of active jobs.
+If
+.I jobspec
+is not present, and neither \fB\-a\fP nor \fB\-r\fP is supplied,
+the shell's notion of the \fIcurrent job\fP is used.
If the \fB\-h\fP option is given, each
.I jobspec
is not removed from the table, but is marked so that
@@ -6650,7 +7225,7 @@ alert (bell)
backspace
.TP
.B \ec
-suppress trailing newline
+suppress further output
.TP
.B \ee
an escape character
@@ -6683,7 +7258,7 @@ the eight-bit character whose value is the hexadecimal value \fIHH\fP
.PD
.RE
.TP
-\fBenable\fP [\fB\-adnps\fP] [\fB\-f\fP \fIfilename\fP] [\fIname\fP ...]
+\fBenable\fP [\fB\-a\fP] [\fB\-dnps\fP] [\fB\-f\fP \fIfilename\fP] [\fIname\fP ...]
Enable and disable builtin shell commands.
Disabling a builtin allows a disk command which has the same name
as a shell builtin to be executed without specifying a full pathname,
@@ -6744,7 +7319,7 @@ become the arguments to \fIcommand\fP.
If the
.B \-l
option is supplied,
-the shell places a dash at the beginning of the zeroth arg passed to
+the shell places a dash at the beginning of the zeroth argument passed to
.IR command .
This is what
.IR login (1)
@@ -6815,7 +7390,7 @@ is supplied with a
.I name
that is not a function.
.TP
-\fBfc\fP [\fB\-e\fP \fIename\fP] [\fB\-nlr\fP] [\fIfirst\fP] [\fIlast\fP]
+\fBfc\fP [\fB\-e\fP \fIename\fP] [\fB\-lnr\fP] [\fIfirst\fP] [\fIlast\fP]
.PD 0
.TP
\fBfc\fP \fB\-s\fP [\fIpat\fP=\fIrep\fP] [\fIcmd\fP]
@@ -6963,7 +7538,9 @@ is to be used.
.sp 1
When the end of options is encountered, \fBgetopts\fP exits with a
return value greater than zero.
-\fBOPTIND\fP is set to the index of the first non-option argument,
+.SM
+.B OPTIND
+is set to the index of the first non-option argument,
and \fBname\fP is set to ?.
.sp 1
.B getopts
@@ -7060,7 +7637,7 @@ The return status is true unless a
.I name
is not found or an invalid option is supplied.
.TP
-\fBhelp\fP [\fB\-s\fP] [\fIpattern\fP]
+\fBhelp\fP [\fB\-dms\fP] [\fIpattern\fP]
Display helpful information about builtin commands. If
.I pattern
is specified,
@@ -7069,8 +7646,19 @@ gives detailed help on all commands matching
.IR pattern ;
otherwise help for all the builtins and shell control structures
is printed.
-The \fB\-s\fP option restricts the information displayed to a short
-usage synopsis.
+.RS
+.PD 0
+.TP
+.B \-d
+Display a short description of each \fIpattern\fP
+.TP
+.B \-m
+Display the description of each \fIpattern\fP in a manpage-like format
+.TP
+.B \-s
+Display only a short usage synopsis for each \fIpattern\fP
+.PD
+.RE
The return status is 0 unless no command matches
.IR pattern .
.TP
@@ -7096,7 +7684,10 @@ have been modified. An argument of
lists only the last
.I n
lines.
-If the shell variable \fBHISTTIMEFORMAT\fP is set and not null,
+If the shell variable
+.SM
+.B HISTTIMEFORMAT
+is set and not null,
it is used as a format string for \fIstrftime\fP(3) to display
the time stamp associated with each displayed history entry.
No intervening blank is printed between the formatted time stamp
@@ -7148,8 +7739,15 @@ history list is removed before the
are added.
.PD
.PP
-If the \fBHISTTIMEFORMAT\fP is set, the time stamp information
-associated with each history entry is written to the history file.
+If the
+.SM
+.B HISTTIMEFORMAT
+variable is set, the time stamp information
+associated with each history entry is written to the history file,
+marked with the history comment character.
+When the history file is read, lines beginning with the history
+comment character followed immediately by a digit are interpreted
+as timestamps for the previous history line.
The return value is 0 unless an invalid option is encountered, an
error occurs while reading or writing the history file, an invalid
\fIoffset\fP is supplied as an argument to \fB\-d\fP, or the
@@ -7259,7 +7857,8 @@ Each
.I arg
is an arithmetic expression to be evaluated (see
.SM
-.BR "ARITHMETIC EVALUATION" ).
+.B "ARITHMETIC EVALUATION"
+above).
If the last
.I arg
evaluates to 0,
@@ -7292,6 +7891,76 @@ is supplied, or
.B logout
Exit a login shell.
.TP
+\fBmapfile\fP [\fB\-n\fP \fIcount\fP] [\fB\-O\fP \fIorigin\fP] [\fB\-s\fP \fIcount\fP] [\fB\-t\fP] [\fB\-u\fP \fIfd\fP] [\fB\-C\fP \fIcallback\fP] [\fB\-c\fP \fIquantum\fP] [\fIarray\fP]
+.PD 0
+.TP
+\fBreadarray\fP [\fB\-n\fP \fIcount\fP] [\fB\-O\fP \fIorigin\fP] [\fB\-s\fP \fIcount\fP] [\fB\-t\fP] [\fB\-u\fP \fIfd\fP] [\fB\-C\fP \fIcallback\fP] [\fB\-c\fP \fIquantum\fP] [\fIarray\fP]
+.PD
+Read lines from the standard input into the indexed array variable
+.IR array ,
+or from file descriptor
+.IR fd
+if the
+.B \-u
+option is supplied.
+The variable
+.SM
+.B MAPFILE
+is the default \fIarray\fP.
+Options, if supplied, have the following meanings:
+.RS
+.PD 0
+.TP
+.B \-n
+Copy at most
+.I count
+lines. If \fIcount\fP is 0, all lines are copied.
+.TP
+.B \-O
+Begin assigning to
+.I array
+at index
+.IR origin .
+The default index is 0.
+.TP
+.B \-s
+Discard the first \fIcount\fP lines read.
+.TP
+.B \-t
+Remove a trailing newline from each line read.
+.TP
+.B \-u
+Read lines from file descriptor \fIfd\fP instead of the standard input.
+.TP
+.B \-C
+Evaluate
+.I callback
+each time \fIquantum\fP lines are read. The \fB\-c\fP option specifies
+.IR quantum .
+.TP
+.B \-c
+Specify the number of lines read between each call to
+.IR callback .
+.PD
+.PP
+If
+.B \-C
+is specified without
+.BR \-c ,
+the default quantum is 5000.
+When \fIcallback\fP is evaluated, it is supplied the index of the next
+array element to be assigned as an additional argument.
+\fIcallback\fP is evaluated after the line is read but before the
+array element is assigned.
+.PP
+If not supplied with an explicit origin, \fBmapfile\fP will clear \fIarray\fP
+before assigning to it.
+.PP
+\fBmapfile\fP returns successfully unless an invalid option or option
+argument is supplied, \fIarray\fP is invalid or unassignable, or if
+\fIarray\fP is not an indexed array.
+.RE
+.TP
\fBpopd\fP [\-\fBn\fP] [+\fIn\fP] [\-\fIn\fP]
Removes entries from the directory stack. With no arguments,
removes the top directory from the stack, and performs a
@@ -7301,6 +7970,10 @@ Arguments, if supplied, have the following meanings:
.RS
.PD 0
.TP
+.B \-n
+Suppresses the normal change of directory when removing directories
+from the stack, so that only the stack is manipulated.
+.TP
\fB+\fP\fIn\fP
Removes the \fIn\fPth entry counting from the left of the list
shown by
@@ -7324,10 +7997,6 @@ removes the last directory,
.if n ``popd -1''
.if t \f(CWpopd -1\fP
the next to last.
-.TP
-.B \-n
-Suppresses the normal change of directory when removing directories
-from the stack, so that only the stack is manipulated.
.PD
.PP
If the
@@ -7366,10 +8035,10 @@ extra format specifications behave as if a zero value or null string, as
appropriate, had been supplied. The return value is zero on success,
non-zero on failure.
.TP
-\fBpushd\fP [\fB\-n\fP] [\fIdir\fP]
+\fBpushd\fP [\fB\-n\fP] [+\fIn\fP] [\-\fIn\fP]
.PD 0
.TP
-\fBpushd\fP [\fB\-n\fP] [+\fIn\fP] [\-\fIn\fP]
+\fBpushd\fP [\fB\-n\fP] [\fIdir\fP]
.PD
Adds a directory to the top of the directory stack, or rotates
the stack, making the new top of the stack the current working
@@ -7379,6 +8048,10 @@ Arguments, if supplied, have the following meanings:
.RS
.PD 0
.TP
+.B \-n
+Suppresses the normal change of directory when adding directories
+to the stack, so that only the stack is manipulated.
+.TP
\fB+\fP\fIn\fP
Rotates the stack so that the \fIn\fPth directory
(counting from the left of the list shown by
@@ -7392,10 +8065,6 @@ Rotates the stack so that the \fIn\fPth directory
.BR dirs ,
starting with zero) is at the top.
.TP
-.B \-n
-Suppresses the normal change of directory when adding directories
-to the stack, so that only the stack is manipulated.
-.TP
.I dir
Adds
.I dir
@@ -7436,7 +8105,7 @@ The return status is 0 unless an error occurs while
reading the name of the current directory or an
invalid option is supplied.
.TP
-\fBread\fP [\fB\-ers\fP] [\fB\-u\fP \fIfd\fP] [\fB\-t\fP \fItimeout\fP] [\fB\-a\fP \fIaname\fP] [\fB\-p\fP \fIprompt\fP] [\fB\-n\fP \fInchars\fP] [\fB\-d\fP \fIdelim\fP] [\fIname\fP ...]
+\fBread\fP [\fB\-ers\fP] [\fB\-a\fP \fIaname\fP] [\fB\-d\fP \fIdelim\fP] [\fB\-i\fP \fItext\fP] [\fB\-n\fP \fInchars\fP] [\fB\-N\fP \fInchars\fP] [\fB\-p\fP \fIprompt\fP] [\fB\-t\fP \fItimeout\fP] [\fB\-u\fP \fIfd\fP] [\fIname\fP ...]
One line is read from the standard input, or from the file descriptor
\fIfd\fP supplied as an argument to the \fB\-u\fP option, and the first word
is assigned to the first
@@ -7479,10 +8148,27 @@ is coming from a terminal,
.SM
.B READLINE
above) is used to obtain the line.
+Readline uses the current (or default, if line editing was not previously
+active) editing settings.
+.TP
+.B \-i \fItext\fP
+If
+.B readline
+is being used to read the line, \fItext\fP is placed into the editing
+buffer before editing begins.
.TP
.B \-n \fInchars\fP
\fBread\fP returns after reading \fInchars\fP characters rather than
-waiting for a complete line of input.
+waiting for a complete line of input, but honor a delimiter if fewer
+than \fInchars\fP characters are read before the delimiter.
+.TP
+.B \-N \fInchars\fP
+\fBread\fP returns after reading exactly \fInchars\fP characters rather
+than waiting for a complete line of input, unless EOF is encountered or
+\fBread\fP times out.
+Delimiter characters encountered in the input are
+not treated specially and do not cause \fBread\fP to return until
+\fInchars\fP characters are read.
.TP
.B \-p \fIprompt\fP
Display \fIprompt\fP on standard error, without a
@@ -7502,8 +8188,14 @@ not echoed.
.B \-t \fItimeout\fP
Cause \fBread\fP to time out and return failure if a complete line of
input is not read within \fItimeout\fP seconds.
-This option has no effect if \fBread\fP is not reading input from the
-terminal or a pipe.
+\fItimeout\fP may be a decimal number with a fractional portion following
+the decimal point.
+This option is only effective if \fBread\fP is reading input from a
+terminal, pipe, or other special file; it has no effect when reading
+from regular files.
+If \fItimeout\fP is 0, \fBread\fP returns success if input is available on
+the specified file descriptor, failure otherwise.
+The exit status is greater than 128 if the timeout is exceeded.
.TP
.B \-u \fIfd\fP
Read input from file descriptor \fIfd\fP.
@@ -7515,11 +8207,11 @@ are supplied, the line read is assigned to the variable
.SM
.BR REPLY .
The return code is zero, unless end-of-file is encountered, \fBread\fP
-times out, or an invalid file descriptor is supplied as the argument to
-\fB\-u\fP.
+times out (in which case the return code is greater than 128), or an
+invalid file descriptor is supplied as the argument to \fB\-u\fP.
.RE
.TP
-\fBreadonly\fP [\fB\-apf\fP] [\fIname\fP[=\fIword\fP] ...]
+\fBreadonly\fP [\fB\-aApf\fP] [\fIname\fP[=\fIword\fP] ...]
.PD
The given
\fInames\fP are marked readonly; the values of these
@@ -7532,7 +8224,9 @@ option is supplied, the functions corresponding to the
marked.
The
.B \-a
-option restricts the variables to arrays.
+option restricts the variables to indexed arrays; the
+.B \-A
+option restricts the variables to associative arrays.
If no
.I name
arguments are given, or if the
@@ -7572,7 +8266,11 @@ the return status is false.
Any command associated with the \fBRETURN\fP trap is executed
before execution resumes after the function or script.
.TP
-\fBset\fP [\fB\-\-abefhkmnptuvxBCHP\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...]
+\fBset\fP [\fB\-\-abefhkmnptuvxBCEHPT\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...]
+.PD 0
+.TP
+\fBset\fP [\fB+abefhkmnptuvxBCEHPT\fP] [\fB+o\fP \fIoption\fP] [\fIarg\fP ...]
+.PD
Without options, the name and value of each shell variable are displayed
in a format that can be reused as input
for setting or resetting the currently-set variables.
@@ -7580,7 +8278,7 @@ Read-only variables cannot be reset.
In \fIposix mode\fP, only shell variables are listed.
The output is sorted according to the current locale.
When options are specified, they set or unset shell attributes.
-Any arguments remaining after the options are processed are treated
+Any arguments remaining after option processing are treated
as values for the positional parameters and are assigned, in order, to
.BR $1 ,
.BR $2 ,
@@ -7600,7 +8298,10 @@ immediately, rather than before the next primary prompt. This is
effective only when job control is enabled.
.TP 8
.B \-e
-Exit immediately if a \fIsimple command\fP (see
+Exit immediately if a \fIpipeline\fP (which may consist of a single
+\fIsimple command\fP), a \fIsubshell\fP command enclosed in parentheses,
+or one of the commands executed as part of a command list enclosed
+by braces (see
.SM
.B SHELL GRAMMAR
above) exits with a non-zero status.
@@ -7610,16 +8311,26 @@ command that fails is part of the command list immediately following a
or
.B until
keyword,
-part of the test in an
-.I if
-statement, part of a
+part of the test following the
+.B if
+or
+.B elif
+reserved words, part of any command executed in a
.B &&
or
.B \(bv\(bv
-list, or if the command's return value is
-being inverted via
+list except the command following the final \fB&&\fP or \fB\(bv\(bv\fP,
+any command in a pipeline but the last,
+or if the command's return value is
+being inverted with
.BR ! .
A trap on \fBERR\fP, if set, is executed before the shell exits.
+This option applies to the shell environment and each subshell environment
+separately (see
+.SM
+.B "COMMAND EXECUTION ENVIRONMENT"
+above), and may cause
+subshells to exit before executing all the commands in the subshell.
.TP 8
.B \-f
Disable pathname expansion.
@@ -7666,6 +8377,11 @@ by default when the shell is interactive, unless the shell is started
with the
.B \-\-noediting
option.
+This also affects the editing interface used for \fBread \-e\fP.
+.TP 8
+.B errexit
+Same as
+.BR \-e .
.TP 8
.B errtrace
Same as
@@ -7675,10 +8391,6 @@ Same as
Same as
.BR \-T .
.TP 8
-.B errexit
-Same as
-.BR \-e .
-.TP 8
.B hashall
Same as
.BR \-h .
@@ -7721,6 +8433,7 @@ Same as
.B noglob
Same as
.BR \-f .
+.TP 8
.B nolog
Currently ignored.
.TP 8
@@ -7762,6 +8475,7 @@ Same as
.TP 8
.B vi
Use a vi-style command line editing interface.
+This also affects the editing interface used for \fBread \-e\fP.
.TP 8
.B xtrace
Same as
@@ -7792,8 +8506,15 @@ and
files are not processed, shell functions are not inherited from the
environment, and the
.SM
-.B SHELLOPTS
-variable, if it appears in the environment, is ignored.
+.BR SHELLOPTS ,
+.SM
+.BR BASHOPTS ,
+.SM
+.BR CDPATH ,
+and
+.SM
+.B GLOBIGNORE
+variables, if they appear in the environment, are ignored.
If the shell is started with the effective user (group) id not equal to the
real user (group) id, and the \fB\-p\fP option is not supplied, these actions
are taken and the effective user id is set to the real user id.
@@ -7806,9 +8527,10 @@ and group ids to be set to the real user and group ids.
Exit after reading and executing one command.
.TP 8
.B \-u
-Treat unset variables as an error when performing
+Treat unset variables and parameters other than the special
+parameters "@" and "*" as an error when performing
parameter expansion. If expansion is attempted on an
-unset variable, the shell prints an error message, and,
+unset variable or parameter, the shell prints an error message, and,
if not interactive, exits with a non-zero status.
.TP 8
.B \-v
@@ -7972,6 +8694,11 @@ The list of \fBshopt\fP options is:
.if n .sp 1v
.PD 0
.TP 8
+.B autocd
+If set, a command name that is the name of a directory is executed as if
+it were the argument to the \fBcd\fP command.
+This option is only used by interactive shells.
+.TP 8
.B cdable_vars
If set, an argument to the
.B cd
@@ -7994,6 +8721,16 @@ If set, \fBbash\fP checks that a command found in the hash
table exists before trying to execute it. If a hashed command no
longer exists, a normal path search is performed.
.TP 8
+.B checkjobs
+If set, \fBbash\fP lists the status of any stopped and running jobs before
+exiting an interactive shell. If any jobs are running, this causes
+the exit to be deferred until a second exit is attempted without an
+intervening command (see
+.SM
+.B "JOB CONTROL"
+above). The shell always
+postpones exiting if any jobs are stopped.
+.TP 8
.B checkwinsize
If set, \fBbash\fP checks the window size after each command
and, if necessary, updates the values of
@@ -8010,6 +8747,31 @@ attempts to save all lines of a multiple-line
command in the same history entry. This allows
easy re-editing of multi-line commands.
.TP 8
+.B compat31
+If set,
+.B bash
+changes its behavior to that of version 3.1 with respect to quoted
+arguments to the conditional command's =~ operator.
+.TP 8
+.B compat32
+If set,
+.B bash
+changes its behavior to that of version 3.2 with respect to locale-specific
+string comparison when using the conditional command's < and > operators.
+.TP 8
+.B compat40
+If set,
+.B bash
+changes its behavior to that of version 4.0 with respect to locale-specific
+string comparison when using the conditional command's < and > operators
+and the effect of interrupting a command list.
+.TP 8
+.B dirspell
+If set,
+.B bash
+attempts spelling correction on directory names during word completion
+if the directory name initially supplied does not exist.
+.TP 8
.B dotglob
If set,
.B bash
@@ -8050,8 +8812,12 @@ executed by the \fB.\fP or \fBsource\fP builtins), a call to
\fBreturn\fP is simulated.
.TP
.B 4.
-\fBBASH_ARGC\fP and \fBBASH_ARGV\fP are updated as described in their
-descriptions above.
+.SM
+.B BASH_ARGC
+and
+.SM
+.B BASH_ARGV
+are updated as described in their descriptions above.
.TP
.B 5.
Function tracing is enabled: command substitution, shell functions, and
@@ -8078,15 +8844,26 @@ If set, patterns which fail to match filenames during pathname expansion
result in an expansion error.
.TP 8
.B force_fignore
-If set, the suffixes specified by the \fBFIGNORE\fP shell variable
+If set, the suffixes specified by the
+.SM
+.B FIGNORE
+shell variable
cause words to be ignored when performing word completion even if
the ignored words are the only possible completions.
See
.SM
\fBSHELL VARIABLES\fP
-above for a description of \fBFIGNORE\fP.
+above for a description of
+.SM
+.BR FIGNORE .
This option is enabled by default.
.TP 8
+.B globstar
+If set, the pattern \fB**\fP used in a pathname expansion context will
+match a files and zero or more directories and subdirectories.
+If the pattern is followed by a \fB/\fP, only directories and
+subdirectories match.
+.TP 8
.B gnu_errfmt
If set, shell error messages are written in the standard GNU error
message format.
@@ -8094,6 +8871,7 @@ message format.
.B histappend
If set, the history list is appended to the file named by the value
of the
+.SM
.B HISTFILE
variable when the shell exits, rather than overwriting the file.
.TP 8
@@ -8160,7 +8938,10 @@ If set, and
.B readline
is being used,
.B bash
-will not attempt to search the \fBPATH\fP for possible completions when
+will not attempt to search the
+.SM
+.B PATH
+for possible completions when
completion is attempted on an empty line.
.TP 8
.B nocaseglob
@@ -8231,11 +9012,10 @@ by default.
Suspend the execution of this shell until it receives a
.SM
.B SIGCONT
-signal. The
+signal. A login shell cannot be suspended; the
.B \-f
-option says not to complain if this is
-a login shell; just suspend anyway. The return status is 0 unless
-the shell is a login shell and
+option can be used to override this and force the suspension.
+The return status is 0 unless the shell is a login shell and
.B \-f
is not supplied, or if job control is not enabled.
.TP
@@ -8256,6 +9036,7 @@ an argument of \fB\-\-\fP as signifying the end of options.
.if n .sp 1
Expressions may be combined using the following operators, listed
in decreasing order of precedence.
+The evaluation depends on the number of arguments; see below.
.RS
.PD 0
.TP
@@ -8313,14 +9094,14 @@ under
.BR "CONDITIONAL EXPRESSIONS" ,
the result of the expression is the result of the binary test using
the first and third arguments as operands.
+The \fB\-a\fP and \fB\-o\fP operators are considered binary operators
+when there are three arguments.
If the first argument is \fB!\fP, the value is the negation of
the two-argument test using the second and third arguments.
If the first argument is exactly \fB(\fP and the third argument is
exactly \fB)\fP, the result is the one-argument test of the second
argument.
Otherwise, the expression is false.
-The \fB\-a\fP and \fB\-o\fP operators are considered binary operators
-in this case.
.TP
4 arguments
If the first argument is \fB!\fP, the result is the negation of
@@ -8377,6 +9158,8 @@ Each
is either
a signal name defined in <\fIsignal.h\fP>, or a signal number.
Signal names are case insensitive and the SIG prefix is optional.
+.if t .sp 0.5
+.if n .sp 1
If a
.I sigspec
is
@@ -8404,6 +9187,17 @@ If a
.I sigspec
is
.SM
+.BR RETURN ,
+the command
+.I arg
+is executed each time a shell function or a script executed with the
+\fB.\fP or \fBsource\fP builtins finishes executing.
+.if t .sp 0.5
+.if n .sp 1
+If a
+.I sigspec
+is
+.SM
.BR ERR ,
the command
.I arg
@@ -8420,7 +9214,7 @@ or
keyword,
part of the test in an
.I if
-statement, part of a
+statement, part of a command executed in a
.B &&
or
.B \(bv\(bv
@@ -8428,18 +9222,11 @@ list, or if the command's return value is
being inverted via
.BR ! .
These are the same conditions obeyed by the \fBerrexit\fP option.
-If a
-.I sigspec
-is
-.SM
-.BR RETURN ,
-the command
-.I arg
-is executed each time a shell function or a script executed with the
-\fB.\fP or \fBsource\fP builtins finishes executing.
+.if t .sp 0.5
+.if n .sp 1
Signals ignored upon entry to the shell cannot be trapped or reset.
Trapped signals that are not being ignored are reset to their original
-values in a child process when it is created.
+values in a subshell or subshell environment when one is created.
The return status is false if any
.I sigspec
is invalid; otherwise
@@ -8519,15 +9306,16 @@ The
.B \-f
option suppresses shell function lookup, as with the \fBcommand\fP builtin.
.B type
-returns true if any of the arguments are found, false if
-none are found.
+returns true if all of the arguments are found, false if
+any are not found.
.TP
-\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]]
+\fBulimit\fP [\fB\-HSTabcdefilmnpqrstuvx\fP [\fIlimit\fP]]
Provides control over the resources available to the shell and to
processes started by it, on systems that allow such control.
The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
-set for the given resource. A hard limit cannot be increased once it
-is set; a soft limit may be increased up to the value of the hard limit.
+set for the given resource.
+A hard limit cannot be increased by a non-root user once it is set;
+a soft limit may be increased up to the value of the hard limit.
If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard
limits are set.
The value of
@@ -8552,6 +9340,9 @@ Other options are interpreted as follows:
.B \-a
All current limits are reported
.TP
+.B \-b
+The maximum socket buffer size
+.TP
.B \-c
The maximum size of core files created
.TP
@@ -8571,7 +9362,7 @@ The maximum number of pending signals
The maximum size that may be locked into memory
.TP
.B \-m
-The maximum resident set size
+The maximum resident set size (many systems do not honor this limit)
.TP
.B \-n
The maximum number of open file descriptors (most systems do not
@@ -8600,6 +9391,9 @@ The maximum amount of virtual memory available to the shell
.TP
.B \-x
The maximum number of file locks
+.TP
+.B \-T
+The maximum number of threads
.PD
.PP
If
@@ -8615,7 +9409,9 @@ which is in seconds,
.BR \-p ,
which is in units of 512-byte blocks,
and
-.B \-n
+.BR \-T ,
+.BR \-b ,
+.BR \-n ,
and
.BR \-u ,
which are unscaled values.
@@ -8676,6 +9472,8 @@ Each unset variable or function is removed from the environment
passed to subsequent commands.
If any of
.SM
+.BR COMP_WORDBREAKS ,
+.SM
.BR RANDOM ,
.SM
.BR SECONDS ,
@@ -8732,10 +9530,14 @@ with the exception that the following are disallowed or not performed:
changing directories with \fBcd\fP
.IP \(bu
setting or unsetting the values of
+.SM
.BR SHELL ,
+.SM
.BR PATH ,
+.SM
.BR ENV ,
or
+.SM
.B BASH_ENV
.IP \(bu
specifying command names containing
@@ -8755,7 +9557,10 @@ builtin command
.IP \(bu
importing function definitions from the shell environment at startup
.IP \(bu
-parsing the value of \fBSHELLOPTS\fP from the shell environment at startup
+parsing the value of
+.SM
+.B SHELLOPTS
+from the shell environment at startup
.IP \(bu
redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
.IP \(bu
@@ -8822,12 +9627,6 @@ The \fBbash\fP executable
.FN /etc/profile
The systemwide initialization file, executed for login shells
.TP
-.FN /etc/bash.bashrc
-The systemwide per-interactive-shell startup file
-.TP
-.FN /etc/bash.logout
-The systemwide login shell cleanup file, executed when a login shell exits
-.TP
.FN ~/.bash_profile
The personal initialization file, executed for login shells
.TP
@@ -8847,7 +9646,7 @@ bfox@gnu.org
.PP
Chet Ramey, Case Western Reserve University
.br
-chet@po.cwru.edu
+chet.ramey@case.edu
.SH BUG REPORTS
If you find a bug in
.B bash,
@@ -8914,12 +9713,8 @@ It suffices to place the sequence of commands between
parentheses to force it into a subshell, which may be stopped as
a unit.
.PP
-Commands inside of \fB$(\fP...\fB)\fP command substitution are not
-parsed until substitution is attempted. This will delay error
-reporting until some time after the command is entered. For example,
-unmatched parentheses, even inside shell comments, will result in
-error messages while the construct is being read.
-.PP
Array variables may not (yet) be exported.
+.PP
+There may be only one active coprocess at a time.
.zZ
.zY