No specific user configuration
[platform/upstream/bash.git] / doc / bashref.texi
index b25dad9..eca3c26 100644 (file)
@@ -2,11 +2,9 @@
 @c %**start of header
 @setfilename bashref.info
 @settitle Bash Reference Manual
-@c %**end of header
-
-@setchapternewpage odd
 
 @include version.texi
+@c %**end of header
 
 @copying
 This text is a brief description of the features that are present in
@@ -16,23 +14,15 @@ This is Edition @value{EDITION}, last updated @value{UPDATED},
 of @cite{The GNU Bash Reference Manual},
 for @code{Bash}, Version @value{VERSION}.
 
-Copyright @copyright{} 1988-2005 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
+Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
 any later version published by the Free Software Foundation; with no
-Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
-and with the Back-Cover Texts as in (a) below.  A copy of the license is
-included in the section entitled ``GNU Free Documentation License.''
-
-(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-this GNU Manual, like GNU software.  Copies published by the Free
-Software Foundation raise funds for GNU development.''
+Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
 @end quotation
 @end copying
 
@@ -59,12 +49,6 @@ Software Foundation raise funds for GNU development.''
 @vskip 0pt plus 1filll
 @insertcopying
 
-@sp 1
-Published by the Free Software Foundation @*
-59 Temple Place, Suite 330, @*
-Boston, MA 02111-1307 @*
-USA @*
-
 @end titlepage
 
 @contents
@@ -74,7 +58,8 @@ USA @*
 @top Bash Features
 
 This text is a brief description of the features that are present in
-the Bash shell (version @value{VERSION}, @value{UPDATED})..
+the Bash shell (version @value{VERSION}, @value{UPDATED}).
+The Bash home page is @url{http://www.gnu.org/software/bash/}.
 
 This is Edition @value{EDITION}, last updated @value{UPDATED},
 of @cite{The GNU Bash Reference Manual},
@@ -84,9 +69,9 @@ Bash contains features that appear in other popular shells, and some
 features that only appear in Bash.  Some of the shells that Bash has
 borrowed concepts from are the Bourne Shell (@file{sh}), the Korn Shell
 (@file{ksh}), and the C-shell (@file{csh} and its successor,
-@file{tcsh}). The following menu breaks the features up into
-categories based upon which one of these other shells inspired the
-feature.
+@file{tcsh}).  The following menu breaks the features up into
+categories, noting which features were inspired by other shells and
+which are specific to Bash.
 
 This manual is meant as a brief introduction to features found in
 Bash.  The Bash manual page should be used as the definitive
@@ -102,22 +87,16 @@ reference on shell behavior.
 * Bash Features::              Features found only in Bash.
 * Job Control::                        What job control is and how Bash allows you
                                to use it.
-* Using History Interactively::        Command History Expansion
 * Command Line Editing::       Chapter describing the command line
                                editing features.
+* Using History Interactively::        Command History Expansion
 * Installing Bash::            How to build and install Bash on your system.
 * Reporting Bugs::             How to report bugs in Bash.
 * Major Differences From The Bourne Shell::    A terse list of the differences
                                                between Bash and historical
                                                versions of /bin/sh.
-* Copying This Manual::                Copying this manual.
-* Builtin Index::              Index of Bash builtin commands.
-* Reserved Word Index::                Index of Bash reserved words.
-* Variable Index::             Quick reference helps you find the
-                               variable you want.
-* Function Index::             Index of bindable Readline functions.
-* Concept Index::              General index for concepts described in
-                               this manual.
+* GNU Free Documentation License::     Copying and sharing this documentation.
+* Indexes::                    Various indexes for this manual.
 @end menu
 @end ifnottex
 
@@ -142,7 +121,8 @@ of Unix.
 Bash is largely compatible with @code{sh} and incorporates useful
 features from the Korn shell @code{ksh} and the C shell @code{csh}.
 It is intended to be a conformant implementation of the @sc{ieee}
-@sc{posix} Shell and Tools specification (@sc{ieee} Working Group 1003.2).
+@sc{posix} Shell and Tools portion of the @sc{ieee} @sc{posix}
+specification (@sc{ieee} Standard 1003.1).
 It offers functional improvements over @code{sh} for both interactive and
 programming use.
 
@@ -163,7 +143,7 @@ and symbols are expanded to create larger expressions.
 A Unix shell is both a command interpreter and a programming
 language.  As a command interpreter, the shell provides the user
 interface to the rich set of @sc{gnu} utilities.  The programming
-language features allow these utilitites to be combined.
+language features allow these utilities to be combined.
 Files containing commands can be created, and become
 commands themselves.  These new commands have the same status as
 system commands in directories such as @file{/bin}, allowing users
@@ -189,7 +169,7 @@ Shells also provide a small set of built-in
 commands (@dfn{builtins}) implementing functionality impossible
 or inconvenient to obtain via separate utilities.
 For example, @code{cd}, @code{break}, @code{continue}, and
-@code{exec}) cannot be implemented outside of the shell because
+@code{exec} cannot be implemented outside of the shell because
 they directly manipulate the shell itself.
 The @code{history}, @code{getopts}, @code{kill}, or @code{pwd}
 builtins, among others, could be implemented in separate utilities,
@@ -217,7 +197,8 @@ These definitions are used throughout the remainder of this manual.
 @item POSIX
 @cindex POSIX
 A family of open system standards based on Unix.  Bash
-is concerned with @sc{posix} 1003.2, the Shell and Tools Standard.
+is primarily concerned with the Shell and Utilities portion of the
+@sc{posix} 1003.1 standard. 
 
 @item blank
 A space or tab character.
@@ -229,10 +210,10 @@ than by an executable program somewhere in the file system.
 
 @item control operator
 @cindex control operator
-A @code{word} that performs a control function.  It is a @code{newline}
+A @code{token} that performs a control function.  It is a @code{newline}
 or one of the following:
 @samp{||}, @samp{&&}, @samp{&}, @samp{;}, @samp{;;},
-@samp{|}, @samp{(}, or @samp{)}.
+@samp{|}, @samp{|&}, @samp{(}, or @samp{)}.
 
 @item exit status
 @cindex exit status
@@ -278,6 +259,7 @@ Also referred to as an @code{identifier}.
 @cindex operator, shell
 A @code{control operator} or a @code{redirection operator}.
 @xref{Redirections}, for a list of redirection operators.
+Operators contain at least one unquoted @code{metacharacter}.
 
 @item process group
 @cindex process group
@@ -286,7 +268,7 @@ group @sc{id}.
 
 @item process group ID
 @cindex process group ID
-A unique identifer that represents a @code{process group}
+A unique identifier that represents a @code{process group}
 during its lifetime.
 
 @item reserved word
@@ -307,16 +289,17 @@ of an event occurring in the system.
 @item special builtin
 @cindex special builtin
 A shell builtin command that has been classified as special by the
-@sc{posix} 1003.2 standard.
+@sc{posix} standard.
 
 @item token
 @cindex token
-A sequence of characters considered a single unit by the shell.  It is
-either a @code{word} or an @code{operator}.
+A sequence of characters considered a single unit by the shell.
+It is either a @code{word} or an @code{operator}.
 
 @item word
 @cindex word
-A @code{token} that is not an @code{operator}.
+A sequence of characters treated as a unit by the shell.
+Words may not include unquoted @code{metacharacters}.
 @end table
 
 @node Basic Shell Features
@@ -499,6 +482,7 @@ alert (bell)
 @item \b
 backspace
 @item \e
+@itemx \E
 an escape character (not ANSI C)
 @item \f
 form feed
@@ -514,12 +498,20 @@ vertical tab
 backslash
 @item \'
 single quote
+@item \"
+double quote
 @item \@var{nnn}
 the eight-bit character whose value is the octal value @var{nnn}
 (one to three digits)
 @item \x@var{HH}
 the eight-bit character whose value is the hexadecimal value @var{HH}
 (one or two hex digits)
+@item \u@var{HHHH}
+the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
+@var{HHHH} (one to four hex digits)
+@item \U@var{HHHHHHHH}
+the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
+@var{HHHHHHHH} (one to eight hex digits)
 @item \c@var{x}
 a control-@var{x} character
 @end table
@@ -560,7 +552,7 @@ fashion:
 
 In a non-interactive shell, or an interactive shell in which the
 @code{interactive_comments} option to the @code{shopt}
-builtin is enabled (@pxref{Bash Builtins}),
+builtin is enabled (@pxref{The Shopt Builtin}),
 a word beginning with @samp{#}
 causes that word and all remaining characters on that line to
 be ignored.  An interactive shell without the @code{interactive_comments}
@@ -587,6 +579,8 @@ some other grouping.
                                commands.
 * Lists::                      How to execute commands sequentially.
 * Compound Commands::          Shell commands for control flow.
+* Coprocesses::                        Two-way communication between commands.
+* GNU Parallel::               Running commands in parallel.
 @end menu
 
 @node Simple Commands
@@ -609,21 +603,30 @@ the command was terminated by signal @var{n}.
 @cindex pipeline
 @cindex commands, pipelines
 
-A @code{pipeline} is a sequence of simple commands separated by
-@samp{|}.
+A @code{pipeline} is a sequence of simple commands separated by one of
+the control operators @samp{|} or @samp{|&}.
 
 @rwindex time
 @rwindex !
 @cindex command timing
 The format for a pipeline is
 @example
-[@code{time} [@code{-p}]] [@code{!}] @var{command1} [@code{|} @var{command2} @dots{}]
+[time [-p]] [!] @var{command1} [ | or |& @var{command2} ] @dots{}
 @end example
 
 @noindent
 The output of each command in the pipeline is connected via a pipe
 to the input of the next command.
-That is, each command reads the previous command's output.
+That is, each command reads the previous command's output.  This
+connection is performed before any redirections specified by the
+command.
+
+If @samp{|&} is used, @var{command1}'s standard error, in addition to
+its standard output, is connected to
+@var{command2}'s standard input through the pipe;
+it is shorthand for @code{2>&1 |}.
+This implicit redirection of the standard error to the standard output is
+performed after any redirections specified by the command.
 
 The reserved word @code{time} causes timing statistics
 to be printed for the pipeline once it finishes.
@@ -631,6 +634,9 @@ The statistics currently consist of elapsed (wall-clock) time and
 user and system time consumed by the command's execution.
 The @option{-p} option changes the output format to that specified
 by @sc{posix}.
+When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}),
+it does not recognize @code{time} as a reserved word if the next
+token begins with a @samp{-}.
 The @env{TIMEFORMAT} variable may be set to a format string that
 specifies how the timing information should be displayed.
 @xref{Bash Variables}, for a description of the available formats.
@@ -638,6 +644,12 @@ The use of @code{time} as a reserved word permits the timing of
 shell builtins, shell functions, and pipelines.  An external
 @code{time} command cannot time these easily.
 
+When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}), @code{time}
+may be followed by a newline.  In this case, the shell displays the
+total user and system time consumed by the shell and its children.
+The @env{TIMEFORMAT} variable may be used to specify the format of
+the time information.
+
 If the pipeline is not executed asynchronously (@pxref{Lists}), the
 shell waits for all commands in the pipeline to complete.
 
@@ -684,8 +696,11 @@ Commands separated by a @samp{;} 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.
 
-The control operators @samp{&&} and @samp{||}
-denote @sc{and} lists and @sc{or} lists, respectively.
+@sc{and} and @sc{or} lists are sequences of one or more pipelines
+separated by the control operators @samp{&&} and @samp{||},
+respectively.  @sc{and} and @sc{or} lists are executed with left
+associativity.
+
 An @sc{and} list has the form
 @example
 @var{command1} && @var{command2}
@@ -724,6 +739,10 @@ terminated by a corresponding reserved word or operator.
 Any redirections (@pxref{Redirections}) associated with a compound command
 apply to all commands within that compound command unless explicitly overridden.
 
+In most cases a list of commands in a compound command's description may be
+separated from the rest of the command by one or more newlines, and may be
+followed by a newline in place of a semicolon.
+
 Bash provides looping constructs, conditional commands, and mechanisms
 to group commands and execute them as a unit.
 
@@ -742,9 +761,11 @@ command's syntax, it may be replaced with one or more newlines.
 @rwindex do
 @rwindex done
 The syntax of the @code{until} command is:
+
 @example
 until @var{test-commands}; do @var{consequent-commands}; done
 @end example
+
 Execute @var{consequent-commands} as long as
 @var{test-commands} has an exit status which is not zero.
 The return status is the exit status of the last command executed
@@ -753,6 +774,7 @@ in @var{consequent-commands}, or zero if none was executed.
 @item while
 @rwindex while
 The syntax of the @code{while} command is:
+
 @example
 while @var{test-commands}; do @var{consequent-commands}; done
 @end example
@@ -767,8 +789,9 @@ in @var{consequent-commands}, or zero if none was executed.
 The syntax of the @code{for} command is:
 
 @example
-for @var{name} [in @var{words} @dots{}]; do @var{commands}; done
+for @var{name} [ [in [@var{words} @dots{}] ] ; ] do @var{commands}; done
 @end example
+
 Expand @var{words}, and execute @var{commands} once for each member
 in the resultant list, with @var{name} bound to the current member.
 If @samp{in @var{words}} is not present, the @code{for} command
@@ -784,6 +807,7 @@ An alternate form of the @code{for} command is also supported:
 @example
 for (( @var{expr1} ; @var{expr2} ; @var{expr3} )) ; do @var{commands} ; done
 @end example
+
 First, the arithmetic expression @var{expr1} is evaluated according
 to the rules described below (@pxref{Shell Arithmetic}).
 The arithmetic expression @var{expr2} is then evaluated repeatedly
@@ -791,9 +815,8 @@ until it evaluates to zero.
 Each time @var{expr2} evaluates to a non-zero value, @var{commands} are
 executed and the arithmetic expression @var{expr3} is evaluated.       
 If any expression is omitted, it behaves as if it evaluates to 1.
-The return value is the exit status of the last command in @var{list}
+The return value is the exit status of the last command in @var{commands}
 that is executed, or false if any of the expressions is invalid.
-
 @end table
 
 The @code{break} and @code{continue} builtins (@pxref{Bourne Shell Builtins})
@@ -840,27 +863,32 @@ zero if no condition tested true.
 The syntax of the @code{case} command is:
 
 @example
-@code{case @var{word} in [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{} esac}
+case @var{word} in [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{} esac
 @end example
 
 @code{case} will selectively execute the @var{command-list} corresponding to
 the first @var{pattern} that matches @var{word}.
 If the shell option @code{nocasematch}
-(see the description of @code{shopt} in @ref{Bash Builtins})
+(see the description of @code{shopt} in @ref{The Shopt Builtin})
 is enabled, the match is performed without regard to the case
 of alphabetic characters.
 The @samp{|} is used to separate multiple patterns, and the @samp{)}
 operator terminates a pattern list.
 A list of patterns and an associated command-list is known
-as a @var{clause}.  Each clause must be terminated with @samp{;;}.
+as a @var{clause}.
+
+Each clause must be terminated with @samp{;;}, @samp{;&}, or @samp{;;&}.
 The @var{word} undergoes tilde expansion, parameter expansion, command
 substitution, arithmetic expansion, and quote removal before matching is
 attempted.  Each @var{pattern} undergoes tilde expansion, parameter
 expansion, command substitution, and arithmetic expansion.
 
 There may be an arbitrary number of @code{case} clauses, each terminated
-by a @samp{;;}.  The first pattern that matches determines the
+by a @samp{;;}, @samp{;&}, or @samp{;;&}.
+The first pattern that matches determines the
 command-list that is executed.
+It's a common idiom to use @samp{*} as the final pattern to define the
+default case, since that pattern will always match.
 
 Here is an example using @code{case} in a script that could be used to
 describe one interesting feature of an animal:
@@ -878,6 +906,15 @@ echo " legs."
 @end example
 
 @noindent
+
+If the @samp{;;} operator is used, no subsequent matches are attempted after
+the first pattern match.
+Using @samp{;&}  in place of @samp{;;} causes execution to continue with
+the @var{command-list} associated with the next clause, if any.
+Using @samp{;;&} in place of @samp{;;} causes the shell to test the patterns
+in the next clause, if any, and execute any associated @var{command-list}
+on a successful match.
+
 The return status is zero if no @var{pattern} is matched.  Otherwise, the
 return status is the exit status of the @var{command-list} executed.
 
@@ -895,7 +932,7 @@ The list of words following @code{in} is expanded, generating a list
 of items.  The set of expanded words is printed on the standard
 error output stream, each preceded by a number.  If the
 @samp{in @var{words}} is omitted, the positional parameters are printed,
-as if @samp{in "$@@"} had been specifed.
+as if @samp{in "$@@"} had been specified.
 The @env{PS3} prompt is then displayed and a line is read from the
 standard input.
 If the line consists of a number corresponding to one of the displayed
@@ -948,23 +985,28 @@ the conditional expression @var{expression}.
 Expressions are composed of the primaries described below in
 @ref{Bash Conditional Expressions}.
 Word splitting and filename expansion are not performed on the words
-between the @samp{[[} and @samp{]]}; tilde expansion, parameter and
+between the @code{[[} and @code{]]}; tilde expansion, parameter and
 variable expansion, arithmetic expansion, command substitution, process
 substitution, and quote removal are performed.
 Conditional operators such as @samp{-f} must be unquoted to be recognized
 as primaries.
 
+When used with @code{[[}, the @samp{<} and @samp{>} operators sort
+lexicographically using the current locale.
+
 When the @samp{==} and @samp{!=} operators are used, the string to the
 right of the operator is considered a pattern and matched according
-to the rules described below in @ref{Pattern Matching}.
+to the rules described below in @ref{Pattern Matching},
+as if the @code{extglob} shell option were enabled.
+The @samp{=} operator is identical to @samp{==}.
 If the shell option @code{nocasematch}
-(see the description of @code{shopt} in @ref{Bash Builtins})
+(see the description of @code{shopt} in @ref{The Shopt Builtin})
 is enabled, the match is performed without regard to the case
 of alphabetic characters.
-The return value is 0 if the string matches or does not match
-the pattern, respectively, and 1 otherwise.
-Any part of the pattern may be quoted to force it to be matched as a
-string.
+The return value is 0 if the string matches (@samp{==}) or does not
+match (@samp{!=})the pattern, and 1 otherwise.
+Any part of the pattern may be quoted to force the quoted portion
+to be matched as a string.
 
 An additional binary operator, @samp{=~}, is available, with the same
 precedence as @samp{==} and @samp{!=}.
@@ -975,9 +1017,15 @@ the pattern, and 1 otherwise.
 If the regular expression is syntactically incorrect, the conditional
 expression's return value is 2.
 If the shell option @code{nocasematch}
-(see the description of @code{shopt} in @ref{Bash Builtins})
+(see the description of @code{shopt} in @ref{The Shopt Builtin})
 is enabled, the match is performed without regard to the case
 of alphabetic characters.
+Any part of the pattern may be quoted to force the quoted portion
+to be matched as a string.
+Bracket expressions in regular expressions must be treated carefully,
+since normal quoting characters lose their meanings between brackets.
+If the pattern is stored in a shell variable, quoting the variable
+expansion forces the entire pattern to be matched as a string.
 Substrings matched by parenthesized subexpressions within the regular
 expression are saved in the array variable @code{BASH_REMATCH}.
 The element of @code{BASH_REMATCH} with index 0 is the portion of the string
@@ -985,6 +1033,61 @@ matching the entire regular expression.
 The element of @code{BASH_REMATCH} with index @var{n} is the portion of the
 string matching the @var{n}th parenthesized subexpression.
 
+For example, the following will match a line
+(stored in the shell variable @var{line})
+if there is a sequence of characters in the value consisting of
+any number, including zero, of 
+space characters, zero or one instances of @samp{a}, then a @samp{b}:
+@example
+[[ $line =~ [[:space:]]*(a)?b ]]
+@end example
+
+@noindent
+That means values like @samp{aab} and @samp{  aaaaaab} will match, as
+will a line containing a @samp{b} anywhere in its value.
+
+Storing the regular expression in a shell variable is often a useful
+way to avoid problems with quoting characters that are special to the
+shell.
+It is sometimes difficult to specify a regular expression literally
+without using quotes, or to keep track of the quoting used by regular
+expressions while paying attention to the shell's quote removal.
+Using a shell variable to store the pattern decreases these problems.
+For example, the following is equivalent to the above:
+@example
+pattern='[[:space:]]*(a)?b'
+[[ $line =~ $pattern ]]
+@end example
+
+@noindent
+If you want to match a character that's special to the regular expression
+grammar, it has to be quoted to remove its special meaning.
+This means that in the pattern @samp{xxx.txt}, the @samp{.} matches any
+character in the string (its usual regular expression meaning), but in the
+pattern @samp{"xxx.txt"} it can only match a literal @samp{.}.
+Shell programmers should take special care with backslashes, since backslashes
+are used both by the shell and regular expressions to remove the special
+meaning from the following character.
+The following two sets of commands are @emph{not} equivalent:
+@example
+pattern='\.'
+
+[[ . =~ $pattern ]]
+[[ . =~ \. ]]
+
+[[ . =~ "$pattern" ]]
+[[ . =~ '\.' ]]
+@end example
+
+@noindent
+The first two matches will succeed, but the second two will not, because
+in the second two the backslash will be part of the pattern to be matched.
+In the first two examples, the backslash removes the special meaning from
+@samp{.}, so the literal @samp{.} matches.
+If the string in the first examples were anything other than @samp{.}, say
+@samp{a}, the pattern would not match, because the quoted @samp{.} in the
+pattern loses its special meaning of matching any single character.
+
 Expressions may be combined using the following operators, listed
 in decreasing order of precedence:
 
@@ -1002,11 +1105,11 @@ True if both @var{expression1} and @var{expression2} are true.
 @item @var{expression1} || @var{expression2}
 True if either @var{expression1} or @var{expression2} is true.
 @end table
+
 @noindent
 The @code{&&} and @code{||} operators do not evaluate @var{expression2} if the
 value of @var{expression1} is sufficient to determine the return
 value of the entire conditional expression.
-
 @end table
 
 @node Command Grouping
@@ -1045,13 +1148,172 @@ The semicolon (or newline) following @var{list} is required.
 In addition to the creation of a subshell, there is a subtle difference
 between these two constructs due to historical reasons.  The braces
 are @code{reserved words}, so they must be separated from the @var{list}
-by @code{blank}s.  The parentheses are @code{operators}, and are
+by @code{blank}s or other shell metacharacters.
+The parentheses are @code{operators}, and are
 recognized as separate tokens by the shell even if they are not separated
 from the @var{list} by whitespace.
 
 The exit status of both of these constructs is the exit status of
 @var{list}.
 
+@node Coprocesses
+@subsection Coprocesses
+@cindex coprocess
+
+A @code{coprocess} is a shell command preceded by the @code{coproc}
+reserved word.
+A coprocess is executed asynchronously in a subshell, as if the command
+had been terminated with the @samp{&} control operator, with a two-way pipe
+established between the executing shell and the coprocess.
+
+The format for a coprocess is:
+@example
+coproc [@var{NAME}] @var{command} [@var{redirections}]
+@end example
+
+@noindent
+This creates a coprocess named @var{NAME}.
+If @var{NAME} is not supplied, the default name is @var{COPROC}.
+@var{NAME} must not be supplied if @var{command} is a simple
+command (@pxref{Simple Commands}); otherwise, it is interpreted as
+the first word of the simple command.
+
+When the coprocess is executed, the shell creates an array variable
+(@pxref{Arrays})
+named @env{NAME} in the context of the executing shell.
+The standard output of @var{command}
+is connected via a pipe to a file descriptor in the executing shell,
+and that file descriptor is assigned to @env{NAME}[0].
+The standard input of @var{command}
+is connected via a pipe to a file descriptor in the executing shell,
+and that file descriptor is assigned to @env{NAME}[1].
+This pipe is established before any redirections specified by the
+command (@pxref{Redirections}).
+The file descriptors can be utilized as arguments to shell commands
+and redirections using standard word expansions.
+The file descriptors are not available in subshells.
+
+The process ID of the shell spawned to execute the coprocess is
+available as the value of the variable @env{NAME}_PID.
+The @code{wait}
+builtin command may be used to wait for the coprocess to terminate.
+
+Since the coprocess is created as an asynchronous command,
+the @code{coproc} command always returns success.
+The return status of a coprocess is the exit status of @var{command}.
+
+@node GNU Parallel
+@subsection GNU Parallel
+
+There are ways to run commands in parallel that are not built into Bash.
+GNU Parallel is a tool to do just that.
+
+GNU Parallel, as its name suggests, can be used to build and run commands
+in parallel.  You may run the same command with different arguments, whether
+they are filenames, usernames, hostnames, or lines read from files.  GNU
+Parallel provides shorthand references to many of the most common operations
+(input lines, various portions of the input line, different ways to specify
+the input source, and so on).  Parallel can replace @code{xargs} or feed
+commands from its input sources to several different instances of Bash.
+
+For a complete description, refer to the GNU Parallel documentation.  A few
+examples should provide a brief introduction to its use.
+
+For example, it is easy to replace @code{xargs} to gzip all html files in the
+current directory and its subdirectories:
+@example
+find . -type f -name '*.html' -print | parallel gzip
+@end example
+@noindent
+If you need to protect special characters such as newlines in file names,
+use find's @option{-print0} option and parallel's @option{-0} option.
+
+You can use Parallel to move files from the current directory when the
+number of files is too large to process with one @code{mv} invocation:
+@example
+ls | parallel mv @{@} destdir
+@end example
+
+As you can see, the @{@} is replaced with each line read from standard input.
+While using @code{ls} will work in most instances, it is not sufficient to
+deal with all filenames.
+If you need to accommodate special characters in filenames, you can use
+
+@example
+find . -depth 1 \! -name '.*' -print0 | parallel -0 mv @{@} destdir
+@end example
+
+@noindent
+as alluded to above.
+
+This will run as many @code{mv} commands as there are files in the current
+directory.
+You can emulate a parallel @code{xargs} by adding the @option{-X} option:
+@example
+find . -depth 1 \! -name '.*' -print0 | parallel -0 -X mv @{@} destdir
+@end example
+
+GNU Parallel can replace certain common idioms that operate on lines read
+from a file (in this case, filenames listed one per line):
+@example
+       while IFS= read -r x; do
+               do-something1 "$x" "config-$x"
+               do-something2 < "$x"
+       done < file | process-output
+@end example
+
+@noindent
+with a more compact syntax reminiscent of lambdas:
+@example
+cat list | parallel "do-something1 @{@} config-@{@} ; do-something2 < @{@}" | process-output
+@end example
+
+Parallel provides a built-in mechanism to remove filename extensions, which
+lends itself to batch file transformations or renaming:
+@example
+ls *.gz | parallel -j+0 "zcat @{@} | bzip2 >@{.@}.bz2 && rm @{@}"
+@end example
+@noindent
+This will recompress all files in the current directory with names ending
+in .gz using bzip2, running one job per CPU (-j+0) in parallel.
+(We use @code{ls} for brevity here; using @code{find} as above is more
+robust in the face of filenames containing unexpected characters.)
+Parallel can take arguments from the command line; the above can also be
+written as
+
+@example
+parallel "zcat @{@} | bzip2 >@{.@}.bz2 && rm @{@}" ::: *.gz
+@end example
+
+If a command generates output, you may want to preserve the input order in
+the output.  For instance, the following command
+@example
+@{ echo foss.org.my ; echo debian.org; echo freenetproject.org; @} | parallel traceroute
+@end example
+@noindent
+will display as output the traceroute invocation that finishes first.
+Adding the @option{-k} option 
+@example
+@{ echo foss.org.my ; echo debian.org; echo freenetproject.org; @} | parallel -k traceroute
+@end example
+@noindent
+will ensure that the output of @code{traceroute foss.org.my} is displayed first.
+
+Finally, Parallel can be used to run a sequence of shell commands in parallel,
+similar to @samp{cat file | bash}.
+It is not uncommon to take a list of filenames, create a series of shell
+commands to operate on them, and feed that list of commnds to a shell.
+Parallel can speed this up.  Assuming that @file{file} contains a list of
+shell commands, one per line,
+
+@example
+parallel -j 10 < file
+@end example
+
+@noindent
+will evaluate the commands using the shell (since no explicit command is
+supplied as an argument), in blocks of ten shell jobs at a time.
+
 @node Shell Functions
 @section Shell Functions
 @cindex shell function
@@ -1068,7 +1330,13 @@ shell context; no new process is created to interpret them.
 Functions are declared using this syntax:
 @rwindex function
 @example
-[ @code{function} ] @var{name} () @var{compound-command} [ @var{redirections} ]
+@var{name} () @var{compound-command} [ @var{redirections} ]
+@end example
+
+or
+
+@example
+function @var{name} [()] @var{compound-command} [ @var{redirections} ]
 @end example
 
 This defines a shell function named @var{name}.  The reserved
@@ -1081,9 +1349,15 @@ That command is usually a @var{list} enclosed between @{ and @}, but
 may be any compound command listed above.
 @var{compound-command} is executed whenever @var{name} is specified as the
 name of a command.
+When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}),
+@var{name} may not be the same as one of the special builtins
+(@pxref{Special Builtins}).
 Any redirections (@pxref{Redirections}) associated with the shell function
 are performed when the function is executed.
 
+A function definition may be deleted using the @option{-f} option to the
+@code{unset} builtin (@pxref{Bourne Shell Builtins}).
+
 The exit status of a function definition is zero unless a syntax error
 occurs or a readonly function with the same name already exists.
 When executed, the exit status of a function is the exit status of the
@@ -1093,7 +1367,8 @@ Note that for historical reasons, in the most common usage the curly braces
 that surround the body of the function must be separated from the body by
 @code{blank}s or newlines.
 This is because the braces are reserved words and are only recognized
-as such when they are separated by whitespace.
+as such when they are separated from the command list
+by whitespace or another shell metacharacter.
 Also, when using the braces, the @var{list} must be terminated by a semicolon,
 a @samp{&}, or a newline.
 
@@ -1105,17 +1380,26 @@ positional parameters is updated to reflect the change.
 Special parameter @code{0} is unchanged.
 The first element of the @env{FUNCNAME} variable is set to the
 name of the function while the function is executing.
+
 All other aspects of the shell execution
 environment are identical between a function and its caller
-with the exception that the @env{DEBUG} and @env{RETURN} traps
+with these exceptions:
+the @env{DEBUG} and @env{RETURN} traps
 are not inherited unless the function has been given the
 @code{trace} attribute using the @code{declare} builtin or
 the @code{-o functrace} option has been enabled with
 the @code{set} builtin,
-(in which case all functions inherit the @env{DEBUG} and @env{RETURN} traps).
+(in which case all functions inherit the @env{DEBUG} and @env{RETURN} traps),
+and the @env{ERR} trap is not inherited unless the @code{-o errtrace}
+shell option has been enabled.
 @xref{Bourne Shell Builtins}, for the description of the
 @code{trap} builtin.
 
+The @env{FUNCNEST} variable, if set to a numeric value greater
+than 0, defines a maximum function nesting level.  Function
+invocations that exceed the limit cause the entire command to
+abort.
+
 If the builtin command @code{return}
 is executed in a function, the function completes and
 execution resumes with the next command after the function
@@ -1135,8 +1419,8 @@ Variables local to the function may be declared with the
 the function and the commands it invokes.
 
 Function names and definitions may be listed with the
-@option{-f} option to the @code{declare} or @code{typeset}
-builtin commands (@pxref{Bash Builtins}).
+@option{-f} option to the @code{declare} (@code{typeset})
+builtin command (@pxref{Bash Builtins}).
 The @option{-F} option to @code{declare} or @code{typeset}
 will list the function names only
 (and optionally the source file and line number, if the @code{extdebug}
@@ -1150,8 +1434,10 @@ in multiple identically-named entries in the environment passed to the
 shell's children.
 Care should be taken in cases where this may cause a problem.
 
-Functions may be recursive.  No limit is placed on the number of
-recursive  calls.
+Functions may be recursive.
+The @code{FUNCNEST} variable may be used to limit the depth of the
+function call stack and restrict the number of function invocations.
+By default, no limit is placed on the number of recursive  calls.
 
 @node Shell Parameters
 @section Shell Parameters
@@ -1196,22 +1482,59 @@ Assignment statements may also appear as arguments to the
 @code{alias}, 
 @code{declare}, @code{typeset}, @code{export}, @code{readonly},
 and @code{local} builtin commands.
+When in @sc{posix} mode (@pxref{Bash POSIX Mode}), these builtins may appear
+in a command after one or more instances of the @code{command} builtin
+and retain these assignment statement properties.
 
 In the context where an assignment statement is assigning a value  
 to a shell variable or array index (@pxref{Arrays}), the @samp{+=}
 operator can be used to   
 append to or add to the variable's previous value.
-When @samp{+=} is applied to a variable for which the integer attribute
+When @samp{+=} is applied to a variable for which the @var{integer} attribute
 has been set, @var{value} is evaluated as an arithmetic expression and
 added to the variable's current value, which is also evaluated.
 When @samp{+=} is applied to an array variable using compound assignment
 (@pxref{Arrays}), the
 variable's value is not unset (as it is when using @samp{=}), and new
 values are appended to the array beginning at one greater than the array's
-maximum index.
+maximum index (for indexed arrays),  or added as additional key-value pairs
+in an associative array.
 When applied to a string-valued variable, @var{value} is expanded and
 appended to the variable's value.
 
+A variable can be assigned the @var{nameref} attribute using the
+@option{-n} option to the \fBdeclare\fP or \fBlocal\fP builtin commands
+(@pxref{Bash Builtins})
+to create a @var{nameref}, or a reference to another variable.
+This allows variables to be manipulated indirectly.
+Whenever the nameref variable is referenced or assigned to, the operation
+is actually performed on the variable specified by the nameref variable's
+value.
+A nameref is commonly used within shell functions to refer to a variable
+whose name is passed as an argument to the function.
+For instance, if a variable name is passed to a shell function as its first
+argument, running
+@example
+declare -n ref=$1
+@end example
+@noindent
+inside the function creates a nameref variable @var{ref} whose value is
+the variable name passed as the first argument.
+References and assignments to @var{ref} are treated as references and
+assignments to the variable whose name was passed as @code{$1}.
+
+If the control variable in a @code{for} loop has the nameref attribute,
+the list of words can be a list of shell variables, and a name reference
+will be established for each word in the list, in turn, when the loop is
+executed.
+Array variables cannot be given the @option{-n} attribute.
+However, nameref variables can reference array variables and subscripted
+array variables.
+Namerefs can be unset using the @option{-n} option to the @code{unset} builtin
+(@pxref{Bourne Shell Builtins}).
+Otherwise, if @code{unset} is executed with the name of a nameref variable
+as an argument, the variable referenced by the nameref variable will be unset.
+
 @node Positional Parameters
 @subsection Positional Parameters
 @cindex parameters, positional
@@ -1242,8 +1565,13 @@ only be referenced; assignment to them is not allowed.
 @vtable @code
 
 @item *
-Expands to the positional parameters, starting from one.  When the
-expansion occurs within double quotes, it expands to a single word
+@vindex $*
+($*) Expands to the positional parameters, starting from one.
+When the expansion is not within double quotes, each positional parameter
+expands to a separate word.
+In contexts where it is performed, those words
+are subject to further word splitting and pathname expansion.
+When the expansion occurs within double quotes, it expands to a single word
 with the value of each parameter separated by the first character
 of the @env{IFS}
 special variable.  That is, @code{"$*"} is equivalent
@@ -1254,9 +1582,9 @@ If @env{IFS} is unset, the parameters are separated by spaces.
 If @env{IFS} is null, the parameters are joined without intervening
 separators.
 
-
 @item @@
-Expands to the positional parameters, starting from one.  When the
+@vindex $@@
+($@@) Expands to the positional parameters, starting from one.  When the
 expansion occurs within double quotes, each parameter expands to a
 separate word.  That is, @code{"$@@"} is equivalent to
 @code{"$1" "$2" @dots{}}.
@@ -1269,28 +1597,35 @@ When there are no positional parameters, @code{"$@@"} and
 expand to nothing (i.e., they are removed).
 
 @item #
-Expands to the number of positional parameters in decimal.
+@vindex $#
+($#) Expands to the number of positional parameters in decimal.
 
 @item ?
-Expands to the exit status of the most recently executed foreground
+@vindex $?
+($?) Expands to the exit status of the most recently executed foreground
 pipeline.
 
 @item -
-(A hyphen.)  Expands to the current option flags as specified upon
+@vindex $-
+($-, a hyphen.)  Expands to the current option flags as specified upon
 invocation, by the @code{set}
 builtin command, or those set by the shell itself
 (such as the @option{-i} option).
 
 @item $
-Expands to the process @sc{id} of the shell.  In a @code{()} subshell, it
+@vindex $$
+($$) Expands to the process @sc{id} of the shell.  In a @code{()} subshell, it
 expands to the process @sc{id} of the invoking shell, not the subshell.
 
 @item !
-Expands to the process @sc{id} of the most recently executed background
-(asynchronous) command.
+@vindex $!
+($!) Expands to the process @sc{id} of the job most recently placed into the
+background, whether executed as an asynchronous command or using
+the @code{bg} builtin (@pxref{Job Control Builtins}).
 
 @item 0
-Expands to the name of the shell or shell script.  This is set at
+@vindex $0
+($0) Expands to the name of the shell or shell script.  This is set at
 shell initialization.  If Bash is invoked with a file of commands
 (@pxref{Shell Scripts}), @code{$0} is set to the name of that file.
 If Bash is started with the @option{-c} option (@pxref{Invoking Bash}),
@@ -1299,7 +1634,8 @@ executed, if one is present.  Otherwise, it is set
 to the filename used to invoke Bash, as given by argument zero.
 
 @item _
-(An underscore.)
+@vindex $_
+($_, an underscore.)
 At shell startup, set to the absolute pathname used to invoke the
 shell or shell script being executed as passed in the environment
 or argument list.
@@ -1316,6 +1652,7 @@ When checking mail, this parameter holds the name of the mail file.
 
 Expansion is performed on the command line after it has been split into
 @code{token}s.  There are seven kinds of expansion performed:
+
 @itemize @bullet
 @item brace expansion
 @item tilde expansion
@@ -1341,15 +1678,17 @@ Expansion is performed on the command line after it has been split into
                        words.
 @end menu
 
-The order of expansions is: brace expansion, tilde expansion,
-parameter, variable, and arithmetic expansion and
-command substitution
-(done in a left-to-right fashion), word splitting, and filename
-expansion.
+The order of expansions is:
+brace expansion;
+tilde expansion, parameter and variable expansion, arithmetic expansion,
+and command substitution (done in a left-to-right fashion);
+word splitting;
+and filename expansion.
 
 On systems that can support it, there is an additional expansion
-available: @var{process substitution}.  This is performed at the
-same time as parameter, variable, and arithmetic expansion and
+available: @var{process substitution}.
+This is performed at the
+same time as tilde, parameter, variable, and arithmetic expansion and
 command substitution.
 
 Only brace expansion, word splitting, and filename expansion
@@ -1370,9 +1709,9 @@ is performed.
 Brace expansion is a mechanism by which arbitrary strings may be generated.
 This mechanism is similar to
 @var{filename expansion} (@pxref{Filename Expansion}),
-but the file names generated need not exist.
+but the filenames generated need not exist.
 Patterns to be brace expanded take the form of an optional @var{preamble},
-followed by either a series of comma-separated strings or a sequnce expression
+followed by either a series of comma-separated strings or a sequence expression
 between a pair of braces,
 followed by an optional @var{postscript}.
 The preamble is prefixed to each string contained within the braces, and
@@ -1388,13 +1727,22 @@ bash$ echo a@{d,c,b@}e
 ade ace abe
 @end example
 
-A sequence expression takes the form @code{@{@var{x}..@var{y}@}},
-where @var{x} and @var{y} are either integers or single characters.
+A sequence expression takes the form @code{@{@var{x}..@var{y}[..@var{incr}]@}},
+where @var{x} and @var{y} are either integers or single characters,
+and @var{incr}, an optional increment, is an integer.
 When integers are supplied, the expression expands to each number between
 @var{x} and @var{y}, inclusive.
+Supplied integers may be prefixed with @samp{0} to force each term to have the
+same width.
+When either @var{x} or @var{y} 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 @var{x} and @var{y}, inclusive.  Note that
-both @var{x} and @var{y} must be of the same type.
+lexicographically between @var{x} and @var{y}, inclusive,
+using the default C locale.
+Note that both @var{x} and @var{y} 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.
 
 Brace expansion is performed before any other expansions,
 and any characters special to other expansions are preserved
@@ -1463,7 +1811,7 @@ left unchanged.
 Each variable assignment is checked for unquoted tilde-prefixes immediately
 following a @samp{:} or the first @samp{=}.
 In these cases, tilde expansion is also performed.
-Consequently, one may use file names with tildes in assignments to
+Consequently, one may use filenames with tildes in assignments to
 @env{PATH}, @env{MAILPATH}, and @env{CDPATH},
 and the shell assigns the expanded value.
 
@@ -1493,7 +1841,6 @@ The string that would be displayed by @samp{dirs +@var{N}}
 
 @item ~-@var{N}
 The string that would be displayed by @samp{dirs -@var{N}}
-
 @end table
 
 @node Shell Parameter Expansion
@@ -1514,21 +1861,22 @@ embedded arithmetic expansion, command substitution, or parameter
 expansion.
 
 The basic form of parameter expansion is $@{@var{parameter}@}.
-The value of @var{parameter} is substituted.  The braces are required
-when @var{parameter}
+The value of @var{parameter} is substituted.
+The @var{parameter} is a shell parameter as described above
+(@pxref{Shell Parameters}) or an array reference (@pxref{Arrays}).
+The braces are required when @var{parameter}
 is a positional parameter with more than one digit,
-or when @var{parameter}
-is followed by a character that is not to be
+or when @var{parameter} is followed by a character that is not to be
 interpreted as part of its name.
 
-If the first character of @var{parameter} is an exclamation point,
-a level of variable indirection is introduced.
+If the first character of @var{parameter} is an exclamation point (!),
+it introduces a level of variable indirection.
 Bash uses the value of the variable formed from the rest of
 @var{parameter} as the name of the variable; this variable is then
 expanded and that value is used in the rest of the substitution, rather
 than the value of @var{parameter} itself.
 This is known as @code{indirect expansion}.
-The exceptions to this are the expansions of $@{!@var{prefix*}@}
+The exceptions to this are the expansions of $@{!@var{prefix}*@}
 and $@{!@var{name}[@@]@}
 described below.
 The exclamation point must immediately follow the left brace in order to
@@ -1537,11 +1885,12 @@ introduce indirection.
 In each of the cases below, @var{word} is subject to tilde expansion,
 parameter expansion, command substitution, and arithmetic expansion.
 
-When not performing substring expansion, Bash tests for a parameter
-that is unset or null; omitting the colon results in a test only for a
-parameter that is unset.  Put another way, if the colon is included,
-the operator tests for both existence and that the value is not null;
-if the colon is omitted, the operator tests only for existence.
+When not performing substring expansion, using the form described
+below (e.g., @samp{:-}), Bash tests for a parameter that is unset or null.
+Omitting the colon results in a test only for a parameter that is unset.
+Put another way, if the colon is included,
+the operator tests for both @var{parameter}'s existence and that its value
+is not null; if the colon is omitted, the operator tests only for existence.
 
 @table @code
 
@@ -1573,33 +1922,158 @@ is null or unset, nothing is substituted, otherwise the expansion of
 
 @item $@{@var{parameter}:@var{offset}@}
 @itemx $@{@var{parameter}:@var{offset}:@var{length}@}
-Expands to up to @var{length} characters of @var{parameter}
+This is referred to as Substring Expansion.
+It expands to up to @var{length} characters of the value of @var{parameter}
 starting at the character specified by @var{offset}.
-If @var{length} is omitted, expands to the substring of
-@var{parameter} starting at the character specified by @var{offset}.
+If @var{parameter} is @samp{@@}, an indexed array subscripted by
+@samp{@@} or @samp{*}, or an associative array name, the results differ as
+described below.
+If @var{length} is omitted, it expands to the substring of the value of
+@var{parameter} starting at the character specified by @var{offset}
+and extending to the end of the value.
 @var{length} and @var{offset} are arithmetic expressions
 (@pxref{Shell Arithmetic}).
-This is referred to as Substring Expansion.
 
-@var{length} must evaluate to a number greater than or equal to zero.
 If @var{offset} evaluates to a number less than zero, the value
-is used as an offset from the end of the value of @var{parameter}.
+is used as an offset in characters
+from the end of the value of @var{parameter}.
+If @var{length} evaluates to a number less than zero,
+it is interpreted as an offset in characters
+from the end of the value of @var{parameter} rather than
+a number of characters, and the expansion is the characters between
+@var{offset} and that result.
+Note that a negative offset must be separated from the colon by at least
+one space to avoid being confused with the @samp{:-} expansion.
+
+Here are some examples illustrating substring expansion on parameters and
+subscripted arrays:
+
+@verbatim
+$ string=01234567890abcdefgh
+$ echo ${string:7}
+7890abcdefgh
+$ echo ${string:7:0}
+
+$ echo ${string:7:2}
+78
+$ echo ${string:7:-2}
+7890abcdef
+$ echo ${string: -7}
+bcdefgh
+$ echo ${string: -7:0}
+
+$ echo ${string: -7:2}
+bc
+$ echo ${string: -7:-2}
+bcdef
+$ set -- 01234567890abcdefgh
+$ echo ${1:7}
+7890abcdefgh
+$ echo ${1:7:0}
+
+$ echo ${1:7:2}
+78
+$ echo ${1:7:-2}
+7890abcdef
+$ echo ${1: -7}
+bcdefgh
+$ echo ${1: -7:0}
+
+$ echo ${1: -7:2}
+bc
+$ echo ${1: -7:-2}
+bcdef
+$ array[0]=01234567890abcdefgh
+$ echo ${array[0]:7}
+7890abcdefgh
+$ echo ${array[0]:7:0}
+
+$ echo ${array[0]:7:2}
+78
+$ echo ${array[0]:7:-2}
+7890abcdef
+$ echo ${array[0]: -7}
+bcdefgh
+$ echo ${array[0]: -7:0}
+
+$ echo ${array[0]: -7:2}
+bc
+$ echo ${array[0]: -7:-2}
+bcdef
+@end verbatim
+
 If @var{parameter} is @samp{@@}, the result is @var{length} positional
 parameters beginning at @var{offset}.
-If @var{parameter} is an array name indexed by @samp{@@} or @samp{*},
-the result is the @var{length}
+A negative @var{offset} is taken relative to one greater than the greatest
+positional parameter, so an offset of -1 evaluates to the last positional
+parameter.
+It is an expansion error if @var{length} evaluates to a number less than zero.
+
+The following examples illustrate substring expansion using positional
+parameters:
+
+@verbatim
+$ set -- 1 2 3 4 5 6 7 8 9 0 a b c d e f g h
+$ echo ${@:7}
+7 8 9 0 a b c d e f g h
+$ echo ${@:7:0}
+
+$ echo ${@:7:2}
+7 8
+$ echo ${@:7:-2}
+bash: -2: substring expression < 0
+$ echo ${@: -7:2}
+b c
+$ echo ${@:0}
+./bash 1 2 3 4 5 6 7 8 9 0 a b c d e f g h
+$ echo ${@:0:2}
+./bash 1
+$ echo ${@: -7:0}
+
+@end verbatim
+
+If @var{parameter} is an indexed array name subscripted
+by @samp{@@} or @samp{*}, the result is the @var{length}
 members of the array beginning with @code{$@{@var{parameter}[@var{offset}]@}}.
 A negative @var{offset} is taken relative to one greater than the maximum
 index of the specified array.
-Note that a negative offset must be separated from the colon by at least
-one space to avoid being confused with the @samp{:-} expansion.
+It is an expansion error if @var{length} evaluates to a number less than zero.
+
+These examples show how you can use substring expansion with indexed
+arrays:
+
+@verbatim
+$ array=(0 1 2 3 4 5 6 7 8 9 0 a b c d e f g h)
+$ echo ${array[@]:7}
+7 8 9 0 a b c d e f g h
+$ echo ${array[@]:7:2}
+7 8
+$ echo ${array[@]: -7:2}
+b c
+$ echo ${array[@]: -7:-2}
+bash: -2: substring expression < 0
+$ echo ${array[@]:0}
+0 1 2 3 4 5 6 7 8 9 0 a b c d e f g h
+$ echo ${array[@]:0:2}
+0 1
+$ echo ${array[@]: -7:0}
+
+@end verbatim
+
+Substring expansion applied to an associative array produces undefined
+results.
+
 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 @var{offset} is 0, and the positional parameters are used, @code{$@@} is
+prefixed to the list.
 
 @item $@{!@var{prefix}*@}
 @itemx $@{!@var{prefix}@@@}
 Expands to the names of variables whose names begin with @var{prefix},
 separated by the first character of the @env{IFS} special variable.
+When @samp{@@} is used and the expansion appears within double quotes, each
+variable name expands to a separate word.
 
 @item $@{!@var{name}[@@]@}
 @itemx $@{!@var{name}[*]@}
@@ -1617,6 +2091,11 @@ If @var{parameter} is @samp{*} or @samp{@@}, the value substituted
 is the number of positional parameters.
 If @var{parameter} is an array name subscripted by @samp{*} or @samp{@@}, 
 the value substituted is the number of elements in the array.
+If @var{parameter}
+is an indexed array name subscripted by a negative number, that number is
+interpreted as relative to one greater than the maximum index of
+@var{parameter}, so negative indices count back from the end of the
+array, and an index of -1 references the last element.
 
 @item $@{@var{parameter}#@var{word}@}
 @itemx $@{@var{parameter}##@var{word}@}
@@ -1652,15 +2131,13 @@ the pattern removal operation is applied to each member of the
 array in turn, and the expansion is the resultant list.
 
 @item $@{@var{parameter}/@var{pattern}/@var{string}@} 
-@itemx $@{@var{parameter}//@var{pattern}/@var{string}@}
 
 The @var{pattern} is expanded to produce a pattern just as in
 filename expansion.
 @var{Parameter} is expanded and the longest match of @var{pattern}
 against its value is replaced with @var{string}.
-In the first form, only the first match is replaced.
-The second form causes all matches of @var{pattern} to be
-replaced with @var{string}.
+If @var{pattern} begins with @samp{/}, all matches of @var{pattern} are
+replaced with @var{string}.  Normally only the first match is replaced.
 If @var{pattern} begins with @samp{#}, it must match at the beginning
 of the expanded value of @var{parameter}.
 If @var{pattern} begins with @samp{%}, it must match at the end
@@ -1675,6 +2152,31 @@ is an array variable subscripted with @samp{@@} or @samp{*},
 the substitution operation is applied to each member of the
 array in turn, and the expansion is the resultant list.
 
+@item $@{@var{parameter}^@var{pattern}@}
+@itemx $@{@var{parameter}^^@var{pattern}@}
+@itemx $@{@var{parameter},@var{pattern}@}
+@itemx $@{@var{parameter},,@var{pattern}@}
+This expansion modifies the case of alphabetic characters in @var{parameter}.
+The @var{pattern} is expanded to produce a pattern just as in
+filename expansion.
+Each character in the expanded value of @var{parameter} is tested against
+@var{pattern}, and, if it matches the pattern, its case is converted.
+The pattern should not attempt to match more than one character.
+The @samp{^} operator converts lowercase letters matching @var{pattern}
+to uppercase; the @samp{,} operator converts matching uppercase letters
+to lowercase.
+The @samp{^^} and @samp{,,} expansions convert each matched character in the
+expanded value; the @samp{^} and @samp{,} expansions match and convert only
+the first character in the expanded value.
+If @var{pattern} is omitted, it is treated like a @samp{?}, which matches
+every character.
+If @var{parameter} is @samp{@@} or @samp{*},
+the case modification operation is applied to each positional
+parameter in turn, and the expansion is the resultant list.
+If @var{parameter}
+is an array variable subscripted with @samp{@@} or @samp{*},
+the case modification operation is applied to each member of the
+array in turn, and the expansion is the resultant list.
 @end table
 
 @node Command Substitution
@@ -1730,8 +2232,9 @@ $(( @var{expression} ))
 
 The expression is treated as if it were within double quotes, but
 a double quote inside the parentheses is not treated specially.
-All tokens in the expression undergo parameter expansion, command
-substitution, and quote removal.
+All tokens in the expression undergo parameter and variable expansion,
+command substitution, and quote removal.
+The result is treated as the arithmetic expression to be evaluated.
 Arithmetic expansions may be nested. 
 
 The evaluation is performed according to the rules listed below
@@ -1778,13 +2281,16 @@ The shell scans the results of parameter expansion, command substitution,
 and arithmetic expansion that did not occur within double quotes for
 word splitting.
 
-The shell treats each character of @env{$IFS}
-as a delimiter, and splits the results of the other
-expansions into words on these characters.  If
-@env{IFS} is unset, or its value is exactly @code{<space><tab><newline>},
-the default, then any sequence of @env{IFS}
-characters serves to delimit words.  If @env{IFS}
-has a value other than the default, then sequences of
+The shell treats each character of @env{$IFS} as a delimiter, and splits
+the results of the other expansions into words using these characters
+as field terminators.
+If @env{IFS} is unset, or its value is exactly @code{<space><tab><newline>},
+the default, then sequences of
+@code{ <space>}, @code{<tab>}, and @code{<newline>}
+at the beginning and end of the results of the previous
+expansions are ignored, and any sequence of @env{IFS}
+characters not at the beginning or end serves to delimit words.
+If @env{IFS} has a value other than the default, then sequences of
 the whitespace characters @code{space} and @code{tab}
 are ignored at the beginning and end of the
 word, as long as the whitespace character is in the
@@ -1820,7 +2326,8 @@ After word splitting, unless the @option{-f} option has been set
 If one of these characters appears, then the word is
 regarded as a @var{pattern},
 and replaced with an alphabetically sorted list of
-file names matching the pattern. If no matching file names are found,
+filenames matching the pattern (@pxref{Pattern Matching}).
+If no matching filenames are found,
 and the shell option @code{nullglob} is disabled, the word is left
 unchanged.
 If the @code{nullglob} option is set, and no matches are found, the word
@@ -1830,14 +2337,14 @@ an error message is printed and the command is not executed.
 If the shell option @code{nocaseglob} is enabled, the match is performed
 without regard to the case of alphabetic characters.
 
-When a pattern is used for filename generation, the character @samp{.}
+When a pattern is used for filename expansion, the character @samp{.}
 at the start of a filename or immediately following a slash
 must be matched explicitly, unless the shell option @code{dotglob} is set.
-When matching a file name, the slash character must always be
+When matching a filename, the slash character must always be
 matched explicitly.
 In other cases, the @samp{.} character is not treated specially.
 
-See the description of @code{shopt} in @ref{Bash Builtins},
+See the description of @code{shopt} in @ref{The Shopt Builtin},
 for a description of the @code{nocaseglob}, @code{nullglob},
 @code{failglob}, and @code{dotglob} options.
 
@@ -1875,12 +2382,18 @@ The special pattern characters have the following meanings:
 @table @code
 @item *
 Matches any string, including the null string.
+When the @code{globstar} shell option is enabled, and @samp{*} is used in
+a filename expansion context, two adjacent @samp{*}s used as a single
+pattern will match all files and zero or more directories and
+subdirectories.
+If followed by a @samp{/}, two adjacent @samp{*}s will match only
+directories and subdirectories.
 @item ?
 Matches any single character.
 @item [@dots{}]
 Matches any one of the enclosed characters.  A pair of characters
 separated by a hyphen denotes a @var{range expression};
-any character that sorts between those two characters, inclusive,
+any character that falls between those two characters, inclusive,
 using the current locale's collating sequence and character set,
 is matched.  If the first character following the
 @samp{[} is a @samp{!}  or a @samp{^}
@@ -1889,8 +2402,8 @@ may be matched by including it as the first or last character
 in the set.  A @samp{]} may be matched by including it as the first
 character in the set.
 The sorting order of characters in range expressions is determined by
-the current locale and the value of the @env{LC_COLLATE} shell variable,
-if set.
+the current locale and the values of the
+@env{LC_COLLATE} and @env{LC_ALL} shell variables, if set.
 
 For example, in the default C locale, @samp{[a-dx-z]} is equivalent to
 @samp{[abcdxyz]}.  Many locales sort characters in dictionary order, and in
@@ -1898,12 +2411,13 @@ these locales @samp{[a-dx-z]} is typically not equivalent to @samp{[abcdxyz]};
 it might be equivalent to @samp{[aBbCcDdxXyYz]}, for example.  To obtain
 the traditional interpretation of ranges in bracket expressions, you can
 force the use of the C locale by setting the @env{LC_COLLATE} or
-@env{LC_ALL} environment variable to the value @samp{C}.
+@env{LC_ALL} environment variable to the value @samp{C}, or enable the
+@code{globasciiranges} shell option.
 
 Within @samp{[} and @samp{]}, @var{character classes} can be specified
 using the syntax
 @code{[:}@var{class}@code{:]}, where @var{class} is one of the
-following classes defined in the @sc{posix} 1003.2 standard:
+following classes defined in the @sc{posix} standard:
 @example
 alnum   alpha   ascii   blank   cntrl   digit   graph   lower
 print   punct   space   upper   word    xdigit
@@ -1960,13 +2474,25 @@ result from one of the above expansions are removed.
 Before a command is executed, its input and output
 may be @var{redirected}
 using a special notation interpreted by the shell.
-Redirection may also be used to open and close files for the
+Redirection allows commands' file handles to be
+duplicated, opened, closed,
+made to refer to different files,
+and can change the files the command reads from and writes to.
+Redirection may also be used to modify file handles in the
 current shell execution environment.  The following redirection
 operators may precede or appear anywhere within a
 simple command or may follow a command.
 Redirections are processed in the order they appear, from
 left to right.
 
+Each redirection that may be preceded by a file descriptor number
+may instead be preceded by a word of the form @{@var{varname}@}.
+In this case, for each redirection operator except
+>&- and <&-, the shell will allocate a file descriptor greater
+than 10 and assign it to @{@var{varname}@}.  If >&- or <&- is preceded
+by @{@var{varname}@}, the value of @var{varname} defines the file
+descriptor to close.
+
 In the following descriptions, if the file descriptor number is
 omitted, and the first character of the redirection operator is
 @samp{<}, the redirection refers to the standard input (file
@@ -1993,7 +2519,7 @@ ls 2>&1 > @var{dirlist}
 @end example
 @noindent
 directs only the standard output to file @var{dirlist},
-because the standard error was duplicated as standard output
+because the standard error was made a copy of the standard output
 before the standard output was redirected to @var{dirlist}.
 
 Bash handles several filenames specially when they are used in
@@ -2014,14 +2540,13 @@ File descriptor 2 is duplicated.
 
 @item /dev/tcp/@var{host}/@var{port}
 If @var{host} is a valid hostname or Internet address, and @var{port}
-is an integer port number or service name, Bash attempts to open a TCP
-connection to the corresponding socket.
+is an integer port number or service name, Bash attempts to open
+the corresponding TCP socket.
 
 @item /dev/udp/@var{host}/@var{port}
 If @var{host} is a valid hostname or Internet address, and @var{port}
-is an integer port number or service name, Bash attempts to open a UDP
-connection to the corresponding socket.
-
+is an integer port number or service name, Bash attempts to open 
+the corresponding UDP socket.
 @end table
 
 A failure to open or create a file causes the redirection to fail.
@@ -2077,11 +2602,11 @@ The general format for appending output is:
 @end example
 
 @subsection Redirecting Standard Output and Standard Error
-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 @var{word} with this construct.
+expansion of @var{word}.
 
 There are two formats for redirecting standard output and
 standard error:
@@ -2099,6 +2624,27 @@ This is semantically equivalent to
 @example
 >@var{word} 2>&1
 @end example
+When using the second form, @var{word} may not expand to a number or
+@samp{-}.  If it does, other redirection operators apply
+(see Duplicating File Descriptors below) for compatibility reasons.
+
+@subsection Appending Standard Output and Standard Error
+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 @var{word}.
+
+The format for appending standard output and standard error is:
+@example
+&>>@var{word}
+@end example
+@noindent
+This is semantically equivalent to
+@example
+>>@var{word} 2>&1
+@end example
+(see Duplicating File Descriptors below).
 
 @subsection Here Documents
 This type of redirection instructs the shell to read input from the
@@ -2114,15 +2660,15 @@ The format of here-documents is:
 @var{delimiter}
 @end example
 
-No parameter expansion, command substitution, arithmetic expansion,
-or filename expansion is performed on
+No parameter and variable expansion, command substitution,
+arithmetic expansion, or filename expansion is performed on
 @var{word}.  If any characters in @var{word} are quoted, the
 @var{delimiter} is the result of quote removal on @var{word},
 and the lines in the here-document are not expanded.
 If @var{word} is unquoted,
-all lines of the here-document are subjected to parameter expansion,
-command substitution, and arithmetic expansion.  In the latter
-case, the character sequence @code{\newline} is ignored, and @samp{\}
+all lines of the here-document are subjected to
+parameter expansion, command substitution, and arithmetic expansion,
+the character sequence @code{\newline} is ignored, and @samp{\}
 must be used to quote the characters
 @samp{\}, @samp{$}, and @samp{`}.
 
@@ -2138,8 +2684,12 @@ A variant of here documents, the format is:
 <<< @var{word}
 @end example
 
-The @var{word} is expanded and supplied to the command on its standard
-input.
+The @var{word} undergoes
+brace expansion, tilde expansion, parameter and variable expansion,
+command substitution, arithmetic expansion, and quote removal.
+Pathname expansion and word splitting are not performed.
+The result is supplied as a single string to the command on its
+standard input.
 
 @subsection Duplicating File Descriptors
 The redirection operator
@@ -2154,8 +2704,8 @@ is made to be a copy of that file descriptor.
 If the digits in @var{word} do not specify a file descriptor open for
 input, a redirection error occurs.
 If @var{word}
-evaluates to @samp{-}, file descriptor @var{n} is closed.  If
-@var{n} is not specified, the standard input (file descriptor 0) is used.
+evaluates to @samp{-}, file descriptor @var{n} is closed.
+If @var{n} is not specified, the standard input (file descriptor 0) is used.
 
 The operator
 @example
@@ -2166,8 +2716,10 @@ is used similarly to duplicate output file descriptors.  If
 @var{n} is not specified, the standard output (file descriptor 1) is used.
 If the digits in @var{word} do not specify a file descriptor open for
 output, a redirection error occurs.
+If @var{word}
+evaluates to @samp{-}, file descriptor @var{n} is closed.
 As a special case, if @var{n} is omitted, and @var{word} does not
-expand to one or more digits, the standard output and standard
+expand to one or more digits or @samp{-}, the standard output and standard
 error are redirected as described previously.
 
 @subsection Moving File Descriptors
@@ -2290,7 +2842,12 @@ pathnames of executable files to avoid multiple @env{PATH} searches
 (see the description of @code{hash} in @ref{Bourne Shell Builtins}).
 A full search of the directories in @env{$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 @code{command_not_found_handle}.
+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.
 
 @item
@@ -2348,7 +2905,7 @@ options enabled at invocation (either by default or with command-line
 arguments) or by @code{set}
 
 @item
-options enabled by @code{shopt}
+options enabled by @code{shopt} (@pxref{The Shopt Builtin})
 
 @item
 shell aliases defined with @code{alias} (@pxref{Aliases})
@@ -2399,6 +2956,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.
 
+Subshells spawned to execute command substitutions inherit the value of
+the @option{-e} option from the parent shell.  When not in @sc{posix} mode,
+Bash clears the @option{-e} option in such subshells.
+
 If a command is followed by a @samp{&} and job control is not active, the
 default standard input for the command is the empty file @file{/dev/null}.
 Otherwise, the invoked command inherits the file descriptors of the calling
@@ -2439,13 +3000,21 @@ parameter assignments are placed in the environment for a command,
 not just those that precede the command name.
 
 When Bash invokes an external command, the variable @samp{$_}
-is set to the full path name of the command and passed to that
+is set to the full pathname of the command and passed to that
 command in its environment.
 
 @node Exit Status
 @subsection Exit Status
 @cindex exit status
 
+The exit status of an executed command is the value returned by the
+@var{waitpid} 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.
+
 For the shell's purposes, a command which exits with a
 zero exit status has succeeded.
 A non-zero exit status indicates failure.
@@ -2505,7 +3074,7 @@ builtin (@pxref{Job Control Builtins}) or marked
 to not receive @code{SIGHUP} using @code{disown -h}.
 
 If the  @code{huponexit} shell option has been set with @code{shopt}
-(@pxref{Bash Builtins}), Bash sends a @code{SIGHUP} to all jobs when
+(@pxref{The Shopt Builtin}), Bash sends a @code{SIGHUP} to all jobs when
 an interactive login shell exits.
 
 If Bash is waiting for a command to complete and receives a signal
@@ -2585,10 +3154,10 @@ under another shell.
 * Bourne Shell Builtins::      Builtin commands inherited from the Bourne
                                Shell.
 * Bash Builtins::              Table of builtins specific to Bash.
-* The Set Builtin::            This builtin is so overloaded it
-                               deserves its own section.
+* Modifying Shell Behavior::   Builtins to modify shell attributes and
+                               optional behavior.
 * Special Builtins::           Builtin commands classified specially by
-                               POSIX.2.
+                               POSIX.
 @end menu
 
 Builtin commands are contained within the shell itself.
@@ -2598,7 +3167,7 @@ the command directly, without invoking another program.
 Builtin commands are necessary to implement functionality impossible
 or inconvenient to obtain with separate utilities.
 
-This section briefly the builtins which Bash inherits from
+This section briefly describes the builtins which Bash inherits from
 the Bourne Shell, as well as the builtin commands which are unique
 to or have been extended in Bash.
 
@@ -2614,14 +3183,20 @@ Many of the builtins have been extended by @sc{posix} or Bash.
 Unless otherwise noted, each builtin command documented as accepting
 options preceded by @samp{-} accepts @samp{--}
 to signify the end of the options.
-For example, the @code{:}, @code{true}, @code{false}, and @code{test}
-builtins do not accept options.
+The @code{:}, @code{true}, @code{false}, and @code{test}
+builtins do not accept options and do not treat @samp{--} specially.
+The @code{exit}, @code{logout}, @code{break}, @code{continue}, @code{let},
+and @code{shift} builtins accept and process arguments beginning
+with @samp{-} without requiring @samp{--}.
+Other builtins that accept arguments but are not specified as accepting
+options interpret arguments beginning with @samp{-} as invalid options and
+require @samp{--} to prevent this interpretation.
 
 @node Bourne Shell Builtins
 @section Bourne Shell Builtins
 
 The following shell builtin commands are inherited from the Bourne Shell.
-These commands are implemented as specified by the @sc{posix} 1003.2 standard.
+These commands are implemented as specified by the @sc{posix} standard.
 
 @table @code
 @item :    @r{(a colon)}
@@ -2629,6 +3204,7 @@ These commands are implemented as specified by the @sc{posix} 1003.2 standard.
 @example
 : [@var{arguments}]
 @end example
+
 Do nothing beyond expanding @var{arguments} and performing redirections.
 The return status is zero.
 
@@ -2637,6 +3213,7 @@ The return status is zero.
 @example
 . @var{filename} [@var{arguments}]
 @end example
+
 Read and execute commands from the @var{filename} argument in the
 current shell context.  If @var{filename} does not contain a slash,
 the @env{PATH} variable is used to find @var{filename}.
@@ -2655,6 +3232,7 @@ This builtin is equivalent to @code{source}.
 @example
 break [@var{n}]
 @end example
+
 Exit from a @code{for}, @code{while}, @code{until}, or @code{select} loop.
 If @var{n} is supplied, the @var{n}th enclosing loop is exited.
 @var{n} must be greater than or equal to 1.
@@ -2663,17 +3241,42 @@ The return status is zero unless @var{n} is not greater than or equal to 1.
 @item cd
 @btindex cd
 @example
-cd [-L|-P] [@var{directory}]
+cd [-L|[-P [-e]] [-@@] [@var{directory}]
 @end example
+
 Change the current working directory to @var{directory}.
-If @var{directory} is not given, the value of the @env{HOME} shell
-variable is used.
-If the shell variable @env{CDPATH} exists, it is used as a search path.
+If @var{directory} is not supplied, the value of the @env{HOME}
+shell variable is used.
+Any additional arguments following @var{directory} are ignored.
+If the shell variable
+@env{CDPATH} exists, it is used as a search path:
+each directory name in @env{CDPATH} is searched for
+@var{directory}, with alternative directory names in @env{CDPATH}
+separated by a colon (@samp{:}).
 If @var{directory} begins with a slash, @env{CDPATH} is not used.
 
-The @option{-P} option means to not follow symbolic links; symbolic
-links are followed by default or with the @option{-L} option.
-If @var{directory} is @samp{-}, it is equivalent to @env{$OLDPWD}.
+The @option{-P} option means to not follow symbolic links: symbolic links
+are resolved while @code{cd} is traversing @var{directory} and before
+processing an instance of @samp{..} in @var{directory}.
+
+By default, or when the @option{-L} option is supplied, symbolic links
+in @var{directory} are resolved after @code{cd} processes an instance
+of @samp{..} in @var{directory}.
+
+If @samp{..} appears in @var{directory}, it is processed by removing the
+immediately preceding pathname component, back to a slash or the beginning
+of @var{directory}.
+
+If the @option{-e} option is supplied with @option{-P}
+and the current working directory cannot be successfully determined
+after a successful directory change, @code{cd} will return an unsuccessful
+status.
+
+On systems that support it, the @option{-@@} option presents the extended
+attributes associated with a file as a directory.              
+
+If @var{directory} is @samp{-}, it is converted to @env{$OLDPWD}
+before the directory change is attempted.
 
 If a non-empty directory name from @env{CDPATH} is used, or if
 @samp{-} is the first argument, and the directory change is
@@ -2688,6 +3291,7 @@ non-zero otherwise.
 @example
 continue [@var{n}]
 @end example
+
 Resume the next iteration of an enclosing @code{for}, @code{while},
 @code{until}, or @code{select} loop.
 If @var{n} is supplied, the execution of the @var{n}th enclosing loop
@@ -2700,6 +3304,7 @@ The return status is zero unless @var{n} is not greater than or equal to 1.
 @example
 eval [@var{arguments}]
 @end example
+
 The arguments are concatenated together into a single command, which is
 then read and executed, and its exit status returned as the exit status
 of @code{eval}.
@@ -2711,15 +3316,21 @@ zero.
 @example
 exec [-cl] [-a @var{name}] [@var{command} [@var{arguments}]]
 @end example
+
 If @var{command}
 is supplied, it replaces the shell without creating a new process.
 If the @option{-l} option is supplied, the shell places a dash at the
-beginning of the zeroth arg passed to @var{command}.
+beginning of the zeroth argument passed to @var{command}.
 This is what the @code{login} program does.
 The @option{-c} option causes @var{command} to be executed with an empty
 environment.
 If @option{-a} is supplied, the shell passes @var{name} as the zeroth
 argument to @var{command}.
+If @var{command}
+cannot be executed for some reason, a non-interactive shell exits,
+unless the @code{execfail} shell option
+is enabled.  In that case, it returns failure.
+An interactive shell returns failure if the file cannot be executed.
 If no @var{command} is specified, redirections may be used to affect
 the current shell environment.  If there are no redirection errors, the
 return status is zero; otherwise the return status is non-zero.
@@ -2729,6 +3340,7 @@ return status is zero; otherwise the return status is non-zero.
 @example
 exit [@var{n}]
 @end example
+
 Exit the shell, returning a status of @var{n} to the shell's parent.
 If @var{n} is omitted, the exit status is that of the last command executed.
 Any trap on @code{EXIT} is executed before the shell terminates.
@@ -2738,12 +3350,13 @@ Any trap on @code{EXIT} is executed before the shell terminates.
 @example
 export [-fn] [-p] [@var{name}[=@var{value}]]
 @end example
+
 Mark each @var{name} to be passed to child processes
 in the environment.  If the @option{-f} option is supplied, the @var{name}s
 refer to shell functions; otherwise the names refer to shell variables.
 The @option{-n} option means to no longer mark each @var{name} for export.
 If no @var{names} are supplied, or if the @option{-p} option is given, a
-list of exported names is displayed.
+list of names of all exported variables is displayed.
 The @option{-p} option displays output in a form that may be reused as input.
 If a variable name is followed by =@var{value}, the value of
 the variable is set to @var{value}.
@@ -2757,10 +3370,11 @@ with a name that is not a shell function.
 @example
 getopts @var{optstring} @var{name} [@var{args}]
 @end example
+
 @code{getopts} is used by shell scripts to parse positional parameters.
 @var{optstring} contains the option characters to be recognized; if a
 character is followed by a colon, the option is expected to have an
-argument, which should be separated from it by white space.
+argument, which should be separated from it by whitespace.
 The colon (@samp{:}) and question mark (@samp{?}) may not be
 used as option characters.
 Each time it is invoked, @code{getopts}
@@ -2779,7 +3393,7 @@ invocation if a new set of parameters is to be used.
 When the end of options is encountered, @code{getopts} exits with a
 return value greater than zero.
 @env{OPTIND} is set to the index of the first non-option argument,
-and @code{name} is set to @samp{?}.
+and @var{name} is set to @samp{?}.
 
 @code{getopts}
 normally parses the positional parameters, but if more arguments are
@@ -2787,7 +3401,7 @@ given in @var{args}, @code{getopts} parses those instead.
 
 @code{getopts} can report errors in two ways.  If the first character of
 @var{optstring} is a colon, @var{silent}
-error reporting is used.  In normal operation diagnostic messages
+error reporting is used.  In normal operation, diagnostic messages
 are printed when invalid options or missing option arguments are
 encountered.
 If the variable @env{OPTERR}
@@ -2809,12 +3423,15 @@ If @code{getopts} is silent, then a colon (@samp{:}) is placed in
 @item hash
 @btindex hash
 @example
-hash [-'r] [-p @var{filename}] [-dt] [@var{name}]
+hash [-r] [-p @var{filename}] [-dt] [@var{name}]
 @end example
-Remember the full pathnames of commands specified as @var{name} arguments,
+
+Each time @code{hash} is invoked, it remembers the full pathnames of the
+commands specified as @var{name} arguments,
 so they need not be searched for on subsequent invocations.
 The commands are found by searching through the directories listed in
 @env{$PATH}.
+Any previously-remembered pathname is discarded.
 The @option{-p} option inhibits the path search, and @var{filename} is
 used as the location of @var{name}.
 The @option{-r} option causes the shell to forget all remembered locations.
@@ -2836,6 +3453,7 @@ option is supplied.
 @example
 pwd [-LP]
 @end example
+
 Print the absolute pathname of the current working directory.
 If the @option{-P} option is supplied, the pathname printed will not
 contain symbolic links.
@@ -2848,15 +3466,21 @@ is supplied.
 @item readonly
 @btindex readonly
 @example
-readonly [-apf] [@var{name}[=@var{value}]] @dots{}
+readonly [-aAf] [-p] [@var{name}[=@var{value}]] @dots{}
 @end example
+
 Mark each @var{name} as readonly.
 The values of these names may not be changed by subsequent assignment.
 If the @option{-f} option is supplied, each @var{name} refers to a shell
 function.
-The @option{-a} option means each @var{name} refers to an array variable.
+The @option{-a} option means each @var{name} refers to an indexed
+array variable; the @option{-A} option means each @var{name} refers
+to an associative array variable.
+If both options are supplied, @option{-A} takes precedence.
 If no @var{name} arguments are given, or if the @option{-p}
 option is supplied, a list of all readonly names is printed.
+The other options may be used to restrict the output to a subset of
+the set of readonly names.
 The @option{-p} option causes output to be displayed in a format that
 may be reused as input.
 If a variable name is followed by =@var{value}, the value of
@@ -2870,16 +3494,22 @@ or the @option{-f} option is supplied with a name that is not a shell function.
 @example
 return [@var{n}]
 @end example
-Cause a shell function to exit with the return value @var{n}.
+
+Cause a shell function to stop executing and return the value @var{n}
+to its caller.
 If @var{n} is not supplied, the return value is the exit status of the
 last command executed in the function.
-This may also be used to terminate execution of a script being executed
-with the @code{.} (or @code{source}) builtin, returning either @var{n} or
+@code{return} may also be used to terminate execution of a script
+being executed with the @code{.} (@code{source}) builtin,
+returning either @var{n} or
 the exit status of the last command executed within the script as the exit
 status of the script.
+If @var{n} is supplied, the return value is its least significant
+8 bits.
 Any command associated with the @code{RETURN} trap is executed
 before execution resumes after the function or script.
-The return status is non-zero if @code{return} is used outside a function
+The return status is non-zero if @code{return} is supplied a non-numeric
+argument or is used outside a function
 and not during the execution of a script by @code{.} or @code{source}.
 
 @item shift
@@ -2887,10 +3517,12 @@ and not during the execution of a script by @code{.} or @code{source}.
 @example
 shift [@var{n}]
 @end example
+
 Shift the positional parameters to the left by @var{n}.
 The positional parameters from @var{n}+1 @dots{} @code{$#} are
-renamed to @code{$1} @dots{} @code{$#}-@var{n}+1.
-Parameters represented by the numbers @code{$#} to @var{n}+1 are unset.
+renamed to @code{$1} @dots{} @code{$#}-@var{n}.
+Parameters represented by the numbers @code{$#} to @code{$#}-@var{n}+1
+are unset.
 @var{n} must be a non-negative number less than or equal to @code{$#}.
 If @var{n} is zero or greater than @code{$#}, the positional parameters
 are not changed.
@@ -2902,7 +3534,13 @@ less than zero, non-zero otherwise.
 @itemx [
 @btindex test
 @btindex [
-Evaluate a conditional expression @var{expr}.
+@example
+test @var{expr}
+@end example
+
+Evaluate a conditional express
+ion @var{expr} and return a status of 0
+(true) or 1 (false).
 Each operator and operand must be a separate argument.
 Expressions are composed of the primaries described below in
 @ref{Bash Conditional Expressions}.
@@ -2914,6 +3552,8 @@ be a @code{]}.
 
 Expressions may be combined using the following operators, listed in
 decreasing order of precedence.
+The evaluation depends on the number of arguments; see below.
+Operator precedence is used when there are five or more arguments.
 
 @table @code
 @item ! @var{expr}
@@ -2950,18 +3590,19 @@ If the first argument is not a valid unary operator, the expression is
 false.
 
 @item 3 arguments
+The following conditions are applied in the order listed.
 If the second argument is one of the binary conditional
 operators (@pxref{Bash Conditional Expressions}), the
 result of the expression is the result of the binary test using the
 first and third arguments as operands.
+The @samp{-a} and @samp{-o} operators are considered binary operators
+when there are three arguments.
 If the first argument is @samp{!}, the value is the negation of
 the two-argument test using the second and third arguments.
 If the first argument is exactly @samp{(} and the third argument is
 exactly @samp{)}, the result is the one-argument test of the second
 argument.
 Otherwise, the expression is false.
-The @samp{-a} and @samp{-o} operators are considered binary operators
-in this case.  
 
 @item 4 arguments
 If the first argument is @samp{!}, the result is the negation of
@@ -2974,11 +3615,15 @@ The expression is parsed and evaluated according to precedence
 using the rules listed above.
 @end table
 
+When used with @code{test} or @samp{[}, the @samp{<} and @samp{>}
+operators sort lexicographically using ASCII ordering.
+
 @item times
 @btindex times
 @example
 times
 @end example
+
 Print out the user and system times used by the shell and its children.
 The return status is zero.
 
@@ -2987,6 +3632,7 @@ The return status is zero.
 @example
 trap [-lp] [@var{arg}] [@var{sigspec} @dots{}]
 @end example
+
 The commands in @var{arg} are to be read and executed when the
 shell receives signal @var{sigspec}.  If @var{arg} is absent (and
 there is a single @var{sigspec}) or
@@ -3004,31 +3650,40 @@ The @option{-l} option causes the shell to print a list of signal names
 and their corresponding numbers.
 Each @var{sigspec} is either a signal name or a signal number.
 Signal names are case insensitive and the @code{SIG} prefix is optional.
+
 If a @var{sigspec}
 is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits.
 If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed
 before every simple command, @code{for} command, @code{case} command,
 @code{select} command, every arithmetic @code{for} command, and before
 the first command executes in a shell function.
-Refer to the description of the @code{extglob} option to the
-@code{shopt} builtin (@pxref{Bash Builtins}) for details of its
+Refer to the description of the @code{extdebug} option to the
+@code{shopt} builtin (@pxref{The Shopt Builtin}) for details of its
 effect on the @code{DEBUG} trap.
+If a @var{sigspec} is @code{RETURN}, the command @var{arg} is executed
+each time a shell function or a script executed with the @code{.} or
+@code{source} builtins finishes executing.
+
 If a @var{sigspec} is @code{ERR}, the command @var{arg} 
-is executed whenever a simple command has a non-zero exit status,
+is executed whenever
+a pipeline (which may consist of a single simple
+command), a list, or a compound command returns a 
+non-zero exit status,
 subject to the following conditions.
 The @code{ERR} trap is not executed if the failed command is part of the
 command list immediately following an @code{until} or @code{while} keyword,
-part of the test in an @code{if} statement,
-part of a @code{&&} or @code{||} list, or if the command's return
+part of the test following the @code{if} or @code{elif} reserved words,
+part of a command executed in a @code{&&} or @code{||} list
+except the command following the final @code{&&} or @code{||},
+any command in a pipeline but the last,
+or if the command's return
 status is being inverted using @code{!}.
-These are the same conditions obeyed by the @code{errexit} option.
-If a @var{sigspec} is @code{RETURN}, the command @var{arg} is executed
-each time a shell function or a script executed with the @code{.} or
-@code{source} builtins finishes executing.
+These are the same conditions obeyed by the @code{errexit} (@option{-e})
+option.
 
 Signals ignored upon entry to the shell cannot be trapped or reset.
-Trapped signals are reset to their original values in a child  
-process when it is created.
+Trapped signals that are not being ignored are reset to their original
+values in a subshell or subshell environment when one is created.
 
 The return status is zero unless a @var{sigspec} does not specify a
 valid signal.
@@ -3038,6 +3693,7 @@ valid signal.
 @example
 umask [-p] [-S] [@var{mode}]
 @end example
+
 Set the shell process's file creation mask to @var{mode}.  If
 @var{mode} begins with a digit, it is interpreted as an octal number;
 if not, it is interpreted as a symbolic mode mask similar
@@ -3057,13 +3713,21 @@ results in permissions of @code{755}.
 @item unset
 @btindex unset
 @example
-unset [-fv] [@var{name}]
+unset [-fnv] [@var{name}]
 @end example
-Each variable or function @var{name} is removed.
-If no options are supplied, or the @option{-v} option is given, each
-@var{name} refers to a shell variable. 
+
+Remove each variable or function @var{name}.
+If the @option{-v} option is given, each
+@var{name} refers to a shell variable and that variable is remvoved.
 If the @option{-f} option is given, the @var{name}s refer to shell
 functions, and the function definition is removed.
+If the @option{-n} option is supplied, and @var{name} is a variable with
+the @var{nameref} attribute, @var{name} will be unset rather than the
+variable it references.
+@option{-n} has no effect if the @option{-f} option is supplied.
+If no options are supplied, each @var{name} refers to a variable; if
+there is no variable by that name, any function with that name is
+unset.
 Readonly variables and functions may not be unset.
 The return status is zero unless a @var{name} is readonly.
 @end table
@@ -3073,14 +3737,14 @@ The return status is zero unless a @var{name} is readonly.
 
 This section describes builtin commands which are unique to
 or have been extended in Bash.
-Some of these commands are specified in the @sc{posix} 1003.2 standard.
+Some of these commands are specified in the @sc{posix} standard.
 
 @table @code
 
 @item alias
 @btindex alias
 @example
-alias [@code{-p}] [@var{name}[=@var{value}] @dots{}]
+alias [-p] [@var{name}[=@var{value}] @dots{}]
 @end example
 
 Without arguments or with the @option{-p} option, @code{alias} prints
@@ -3094,7 +3758,7 @@ Aliases are described in @ref{Aliases}.
 @item bind
 @btindex bind
 @example
-bind [-m @var{keymap}] [-lpsvPSV]
+bind [-m @var{keymap}] [-lpsvPSVX]
 bind [-m @var{keymap}] [-q @var{function}] [-u @var{function}] [-r @var{keyseq}]
 bind [-m @var{keymap}] -f @var{filename}
 bind [-m @var{keymap}] -x @var{keyseq:shell-command}
@@ -3107,9 +3771,10 @@ key and function bindings,
 bind a key sequence to a Readline function or macro,
 or set a Readline variable.
 Each non-option argument is a command as it would appear in a
-Readline initialization file (@pxref{Readline Init File}),
+Readline initialization file (@pxref{Readline Init File}),
 but each binding or command must be passed as a separate argument;  e.g.,
 @samp{"\C-x\C-r":re-read-init-file}.
+
 Options, if supplied, have the following meanings:
 
 @table @code
@@ -3168,7 +3833,17 @@ Remove any current binding for @var{keyseq}.
 @item -x @var{keyseq:shell-command}
 Cause @var{shell-command} to be executed whenever @var{keyseq} is
 entered.
-
+When @var{shell-command} is executed, the shell sets the
+@code{READLINE_LINE} variable to the contents of the Readline line
+buffer and the @code{READLINE_POINT} variable to the current location
+of the insertion point.
+If the executed command changes the value of @code{READLINE_LINE} or
+@code{READLINE_POINT}, those new values will be reflected in the
+editing state.
+
+@item -X
+List all key sequences bound to shell commands and the associated commands
+in a format that can be reused as input.
 @end table
 
 @noindent
@@ -3180,6 +3855,7 @@ error occurs.
 @example
 builtin [@var{shell-builtin} [@var{args}]]
 @end example
+
 Run a shell builtin, passing it @var{args}, and return its exit status.
 This is useful when defining a shell function with the same
 name as a shell builtin, retaining the functionality of the builtin within
@@ -3192,6 +3868,7 @@ builtin command.
 @example
 caller [@var{expr}]
 @end example
+
 Returns the context of any active subroutine call (a shell function or
 a script executed with the @code{.} or @code{source} builtins).
 
@@ -3212,6 +3889,7 @@ call stack.
 @example
 command [-pVv] @var{command} [@var{arguments} @dots{}]
 @end example
+
 Runs @var{command} with @var{arguments} ignoring any shell function
 named @var{command}.
 Only shell builtin commands or commands found by searching the
@@ -3235,7 +3913,7 @@ zero if @var{command} is found, and non-zero if not.
 @item declare
 @btindex declare
 @example
-declare [-afFirtx] [-p] [@var{name}[=@var{value}] @dots{}]
+declare [-aAfFgilnrtux] [-p] [@var{name}[=@var{value}] @dots{}]
 @end example
 
 Declare variables and give them attributes.  If no @var{name}s
@@ -3243,19 +3921,36 @@ are given, then display the values of variables instead.
 
 The @option{-p} option will display the attributes and values of each
 @var{name}.
-When @option{-p} is used, additional options are ignored.
+When @option{-p} is used with @var{name} arguments, additional options,
+other than @option{-f} and @option{-F}, are ignored.
+
+When @option{-p} is supplied without @var{name} arguments, @code{declare}
+will display the attributes and values of all variables having the
+attributes specified by the additional options.
+If no other options are supplied with @option{-p}, @code{declare} will
+display the attributes and values of all shell variables.  The @option{-f}
+option will restrict the display to shell functions.
+
 The @option{-F} option inhibits the display of function definitions;
 only the function name and attributes are printed.
 If the @code{extdebug} shell option is enabled using @code{shopt}
-(@pxref{Bash Builtins}), the source file name and line number where
+(@pxref{The Shopt Builtin}), the source file name and line number where
 the function is defined are displayed as well.
 @option{-F} implies @option{-f}.
+
+The @option{-g} option forces variables to be created or modified at
+the global scope, even when @code{declare} is executed in a shell function.
+It is ignored in all other cases.
+
 The following options can be used to restrict output to variables with
 the specified attributes or to give variables attributes:
 
 @table @code
 @item -a
-Each @var{name} is an array variable (@pxref{Arrays}).
+Each @var{name} is an indexed array variable (@pxref{Arrays}).
+
+@item -A
+Each @var{name} is an associative array variable (@pxref{Arrays}).
 
 @item -f
 Use function names only.
@@ -3265,6 +3960,20 @@ The variable is to be treated as
 an integer; arithmetic evaluation (@pxref{Shell Arithmetic}) is
 performed when the variable is assigned a value.
 
+@item -l
+When the variable is assigned a value, all upper-case characters are
+converted to lower-case.
+The upper-case attribute is disabled.
+
+@item -n
+Give each @var{name} the @var{nameref} attribute, making
+it a name reference to another variable.
+That other variable is defined by the value of @var{name}.
+All references and assignments to @var{name}, except for changing the
+@option{-n} attribute itself, are performed on the variable referenced by
+@var{name}'s value.
+The @option{-n} attribute cannot be applied to array variables.
+
 @item -r
 Make @var{name}s readonly.  These names cannot then be assigned values
 by subsequent assignment statements or unset.
@@ -3275,15 +3984,28 @@ Traced functions inherit the @code{DEBUG} and @code{RETURN} traps from
 the calling shell.
 The trace attribute has no special meaning for variables.
 
+@item -u
+When the variable is assigned a value, all lower-case characters are
+converted to upper-case.
+The lower-case attribute is disabled.
+
 @item -x
 Mark each @var{name} for export to subsequent commands via
 the environment.
 @end table
 
-Using @samp{+} instead of @samp{-} turns off the attribute instead.
+Using @samp{+} instead of @samp{-} turns off the attribute instead,
+with the exceptions that @samp{+a}
+may not be used to destroy an array variable and @samp{+r} will not
+remove the readonly attribute.
 When used in a function, @code{declare} makes each @var{name} local,
-as with the @code{local} command.  If a variable name is followed by
-=@var{value}, the value of the variable is set to @var{value}.
+as with the @code{local} command, unless the @option{-g} option is used.
+If a variable name is followed by =@var{value}, the value of the variable
+is set to @var{value}.
+
+When using @option{-a} or @option{-A} and the compound assignment syntax to 
+create array variables, additional attributes do not take effect until
+subsequent assignments.
 
 The return status is zero unless an invalid option is encountered,
 an attempt is made to define a function using @samp{-f foo=bar},
@@ -3300,9 +4022,10 @@ or an attempt is made to display a non-existent function with @option{-f}.
 @example
 echo [-neE] [@var{arg} @dots{}]
 @end example
+
 Output the @var{arg}s, separated by spaces, terminated with a
 newline.
-The return status is always 0.
+The return status is 0 unless a write error occurs.
 If @option{-n} is specified, the trailing newline is suppressed.
 If the @option{-e} option is given, interpretation of the following
 backslash-escaped characters is enabled.
@@ -3320,8 +4043,9 @@ alert (bell)
 @item \b
 backspace
 @item \c
-suppress trailing newline
+suppress further output
 @item \e
+@itemx \E
 escape
 @item \f
 form feed
@@ -3338,19 +4062,23 @@ backslash
 @item \0@var{nnn}
 the eight-bit character whose value is the octal value @var{nnn}
 (zero to three octal digits)
-@item \@var{nnn}
-the eight-bit character whose value is the octal value @var{nnn}
-(one to three octal digits)
 @item \x@var{HH}
 the eight-bit character whose value is the hexadecimal value @var{HH}
 (one or two hex digits)
+@item \u@var{HHHH}
+the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
+@var{HHHH} (one to four hex digits)
+@item \U@var{HHHHHHHH}
+the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
+@var{HHHHHHHH} (one to eight hex digits)
 @end table
 
 @item enable
 @btindex enable
 @example
-enable [-n] [-p] [-f @var{filename}] [-ads] [@var{name} @dots{}]
+enable [-a] [-dnps] [-f @var{filename}] [@var{name} @dots{}]
 @end example
+
 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,
@@ -3381,21 +4109,33 @@ or there is an error loading a new builtin from a shared object.
 @item help
 @btindex help
 @example
-help [-s] [@var{pattern}]
+help [-dms] [@var{pattern}]
 @end example
+
 Display helpful information about builtin commands.
 If @var{pattern} is specified, @code{help} gives detailed help
 on all commands matching @var{pattern}, otherwise a list of
 the builtins is printed.
-The @option{-s} option restricts the information displayed to a short
-usage synopsis.
+
+Options, if supplied, have the following meanings:
+
+@table @code
+@item -d
+Display a short description of each @var{pattern}
+@item -m
+Display the description of each @var{pattern} in a manpage-like format
+@item -s
+Display only a short usage synopsis for each @var{pattern}
+@end table
+
 The return status is zero unless no command matches @var{pattern}.
 
 @item let
 @btindex let
 @example
-let @var{expression} [@var{expression}]
+let @var{expression} [@var{expression} @dots{}]
 @end example
+
 The @code{let} builtin allows arithmetic to be performed on shell
 variables.  Each @var{expression} is evaluated according to the
 rules given below in @ref{Shell Arithmetic}.  If the
@@ -3407,6 +4147,7 @@ otherwise 0 is returned.
 @example
 local [@var{option}] @var{name}[=@var{value}] @dots{}
 @end example
+
 For each argument, a local variable named @var{name} is created,
 and assigned @var{value}.
 The @var{option} can be any of the options accepted by @code{declare}.
@@ -3421,32 +4162,103 @@ readonly variable.
 @example
 logout [@var{n}]
 @end example
+
 Exit a login shell, returning a status of @var{n} to the shell's
 parent.
 
+@item mapfile
+@btindex mapfile
+@example
+mapfile [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}]
+    [-C @var{callback}] [-c @var{quantum}] [@var{array}]
+@end example
+
+Read lines from the standard input into the indexed array variable @var{array},
+or from file descriptor @var{fd}
+if the @option{-u} option is supplied.
+The variable @code{MAPFILE} is the default @var{array}.
+Options, if supplied, have the following meanings:
+
+@table @code
+
+@item -n
+Copy at most @var{count} lines.  If @var{count} is 0, all lines are copied.
+@item -O
+Begin assigning to @var{array} at index @var{origin}.
+The default index is 0.
+@item -s
+Discard the first @var{count} lines read.
+@item -t
+Remove a trailing newline from each line read.
+@item -u
+Read lines from file descriptor @var{fd} instead of the standard input.
+@item -C
+Evaluate @var{callback} each time @var{quantum}P lines are read.
+The @option{-c} option specifies @var{quantum}.
+@item -c
+Specify the number of lines read between each call to @var{callback}.
+@end table
+
+If @option{-C} is specified without @option{-c}, 
+the default quantum is 5000.
+When @var{callback}  is evaluated, it is supplied the index of the next
+array element to be assigned and the line to be assigned to that element
+as additional arguments.
+@var{callback} is evaluated after the line is read but before the 
+array element is assigned.
+
+If not supplied with an explicit origin, @code{mapfile} will clear @var{array}
+before assigning to it.
+
+@code{mapfile} returns successfully unless an invalid option or option
+argument is supplied, @var{array} is invalid or unassignable, or @var{array}
+is not an indexed array.
+
 @item printf
 @btindex printf
 @example
-@code{printf} [-v @var{var}] @var{format} [@var{arguments}]
+printf [-v @var{var}] @var{format} [@var{arguments}]
 @end example
+
 Write the formatted @var{arguments} to the standard output under the
 control of the @var{format}.
+The @option{-v} option causes the output to be assigned to the variable
+@var{var} rather than being printed to the standard output.
+
 The @var{format} is a character string which contains three types of objects:
 plain characters, which are simply copied to standard output, character
 escape sequences, which are converted and copied to the standard output, and
 format specifications, each of which causes printing of the next successive
 @var{argument}.
-In addition to the standard @code{printf(1)} formats, @samp{%b} causes
-@code{printf} to expand backslash escape sequences in the corresponding
-@var{argument},
-(except that @samp{\c} terminates output, backslashes in
+In addition to the standard @code{printf(1)} formats, @code{printf}
+interprets the following extensions:
+
+@table @code
+@item %b
+Causes @code{printf} to expand backslash escape sequences in the
+corresponding @var{argument},
+except that @samp{\c} terminates output, backslashes in
 @samp{\'}, @samp{\"}, and @samp{\?} are not removed, and octal escapes
-beginning with @samp{\0} may contain up to four digits),
-and @samp{%q} causes @code{printf} to output the
+beginning with @samp{\0} may contain up to four digits.
+@item %q
+Causes @code{printf} to output the
 corresponding @var{argument} in a format that can be reused as shell input.
+@item %(@var{datefmt})T
+Causes @code{printf} to output the date-time string resulting from using
+@var{datefmt} as a format string for @code{strftime}(3).
+The corresponding @var{argument} is an integer representing the number of
+seconds since the epoch.
+Two special argument values may be used: -1 represents the current
+time, and -2 represents the time the shell was invoked.
+If no argument is specified, conversion behaves as if -1 had been given.
+This is an exception to the usual @code{printf} behavior.
+@end table
 
-The @option{-v} option causes the output to be assigned to the variable
-@var{var} rather than being printed to the standard output.
+@noindent
+Arguments to non-string format specifiers are treated as C language constants,
+except that a leading plus or minus sign is allowed, and if the leading
+character is a single or double quote, the value is the ASCII value of
+the following character.
 
 The @var{format} is reused as necessary to consume all of the @var{arguments}.
 If the @var{format} requires more @var{arguments} than are supplied, the
@@ -3457,8 +4269,10 @@ non-zero on failure.
 @item read
 @btindex read
 @example
-read [-ers] [-a @var{aname}] [-d @var{delim}] [-n @var{nchars}] [-p @var{prompt}] [-t @var{timeout}] [-u @var{fd}] [@var{name} @dots{}]
+read [-ers] [-a @var{aname}] [-d @var{delim}] [-i @var{text}] [-n @var{nchars}]
+    [-N @var{nchars}] [-p @var{prompt}] [-t @var{timeout}] [-u @var{fd}] [@var{name} @dots{}]
 @end example
+
 One line is read from the standard input, or from the file descriptor
 @var{fd} supplied as an argument to the @option{-u} option, and the first word
 is assigned to the first @var{name}, the second word to the second @var{name},
@@ -3467,14 +4281,17 @@ to the last @var{name}.
 If there are fewer words read from the input stream than names,
 the remaining names are assigned empty values.
 The characters in the value of the @env{IFS} variable
-are used to split the line into words.
+are used to split the line into words using the same rules the shell
+uses for expansion (described above in @ref{Word Splitting}).
 The backslash character @samp{\} may be used to remove any special
 meaning for the next character read and for line continuation.
 If no names are supplied, the line read is assigned to the
 variable @env{REPLY}.
 The return code is zero, unless end-of-file is encountered, @code{read}
-times out, or an invalid file descriptor is supplied as the argument to
-@option{-u}.
+times out (in which case the return code is greater than 128),
+a variable assignment error (such as assigning to a readonly variable) occurs,
+or an invalid file descriptor is supplied as the argument to @option{-u}.
+
 Options, if supplied, have the following meanings:
 
 @table @code
@@ -3490,10 +4307,25 @@ rather than newline.
 
 @item -e
 Readline (@pxref{Command Line Editing}) is used to obtain the line.
+Readline uses the current (or default, if line editing was not previously
+active) editing settings.
+
+@item -i @var{text}
+If Readline is being used to read the line, @var{text} is placed into
+the editing buffer before editing begins.
 
 @item -n @var{nchars}
 @code{read} returns after reading @var{nchars} characters rather than
-waiting for a complete line of input.
+waiting for a complete line of input, but honor a delimiter if fewer
+than @var{nchars} characters are read before the delimiter.
+
+@item -N @var{nchars}
+@code{read} returns after reading exactly @var{nchars} characters rather
+than waiting for a complete line of input, unless EOF is encountered or
+@code{read} times out.
+Delimiter characters encountered in the input are
+not treated specially and do not cause @code{read} to return until
+@var{nchars} characters are read.
 
 @item -p @var{prompt}
 Display @var{prompt}, without a trailing newline, before attempting
@@ -3512,276 +4344,43 @@ not echoed.
 
 @item -t @var{timeout}
 Cause @code{read} to time out and return failure if a complete line of
-input is not read within @var{timeout} seconds.
-This option has no effect if @code{read} is not reading input from the
-terminal or a pipe.
+input (or a specified number of characters)
+is not read within @var{timeout} seconds.
+@var{timeout}  may be a decimal number with a fractional portion following
+the decimal point.
+This option is only effective if @code{read} is reading input from a
+terminal, pipe, or other special file; it has no effect when reading
+from regular files.
+If @code{read} times out, @code{read} saves any partial input read into
+the specified variable @var{name}.
+If @var{timeout} is 0, @code{read} returns immediately, without trying to
+read and data.  The exit status is 0 if input is available on
+the specified file descriptor, non-zero otherwise.
+The exit status is greater than 128 if the timeout is exceeded.
 
 @item -u @var{fd}
 Read input from file descriptor @var{fd}.
-
 @end table
 
-@item shopt
-@btindex shopt
+@item readarray
+@btindex readarray
 @example
-shopt [-pqsu] [-o] [@var{optname} @dots{}]
+readarray [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}]
+    [-C @var{callback}] [-c @var{quantum}] [@var{array}]
 @end example
-Toggle the values of variables controlling optional shell behavior.
-With no options, or with the @option{-p} option, a list of all settable
-options is displayed, with an indication of whether or not each is set.
-The @option{-p} option causes output to be displayed in a form that
-may be reused as input.
-Other options have the following meanings:
-
-@table @code
-@item -s
-Enable (set) each @var{optname}.
-
-@item -u
-Disable (unset) each @var{optname}.
-
-@item -q
-Suppresses normal output; the return status
-indicates whether the @var{optname} is set or unset.
-If multiple @var{optname} arguments are given with @option{-q},
-the return status is zero if all @var{optnames} are enabled;
-non-zero otherwise.
-
-@item -o
-Restricts the values of
-@var{optname} to be those defined for the @option{-o} option to the
-@code{set} builtin (@pxref{The Set Builtin}).
-@end table
-
-If either @option{-s} or @option{-u}
-is used with no @var{optname} arguments, the display is limited to
-those options which are set or unset, respectively.
-
-Unless otherwise noted, the @code{shopt} options are disabled (off)
-by default.
-
-The return status when listing options is zero if all @var{optnames}
-are enabled, non-zero otherwise.  When setting or unsetting options,
-the return status is zero unless an @var{optname} is not a valid shell
-option.
-
-The list of @code{shopt} options is:
-@table @code
-@item cdable_vars
-If this is set, an argument to the @code{cd}
-builtin command that
-is not a directory is assumed to be the name of a variable whose
-value is the directory to change to.
-
-@item cdspell
-If set, minor errors in the spelling of a directory component in a
-@code{cd} command will be corrected.
-The errors checked for are transposed characters,
-a missing character, and a character too many.
-If a correction is found, the corrected path is printed,
-and the command proceeds.
-This option is only used by interactive shells.
-
-@item checkhash
-If this is set, Bash 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.
-
-@item checkwinsize
-If set, Bash checks the window size after each command
-and, if necessary, updates the values of    
-@env{LINES} and @env{COLUMNS}.
-
-@item cmdhist
-If set, Bash
-attempts to save all lines of a multiple-line
-command in the same history entry.  This allows
-easy re-editing of multi-line commands.
-
-@item dotglob
-If set, Bash includes filenames beginning with a `.' in
-the results of filename expansion.
-
-@item execfail
-If this is set, a non-interactive shell will not exit if
-it cannot execute the file specified as an argument to the @code{exec}
-builtin command.  An interactive shell does not exit if @code{exec}
-fails.
-
-@item expand_aliases
-If set, aliases are expanded as described below under Aliases,
-@ref{Aliases}.
-This option is enabled by default for interactive shells.
-
-@item extdebug
-If set, behavior intended for use by debuggers is enabled:
-
-@enumerate
-@item
-The @option{-F} option to the @code{declare} builtin (@pxref{Bash Builtins})
-displays the source file name and line number corresponding to each function
-name supplied as an argument.
-
-@item
-If the command run by the @code{DEBUG} trap returns a non-zero value, the
-next command is skipped and not executed.
-
-@item
-If the command run by the @code{DEBUG} trap returns a value of 2, and the
-shell is executing in a subroutine (a shell function or a shell script
-executed by the @code{.} or @code{source} builtins), a call to
-@code{return} is simulated.
-
-@item
-@code{BASH_ARGC} and @code{BASH_ARGV} are updated as described in their
-descriptions (@pxref{Bash Variables}).
-
-@item
-Function tracing is enabled:  command substitution, shell functions, and
-subshells invoked with @code{( @var{command} )} inherit the
-@code{DEBUG} and @code{RETURN} traps.
-
-@item
-Error tracing is enabled:  command substitution, shell functions, and
-subshells invoked with @code{( @var{command} )} inherit the
-@code{ERROR} trap.
-@end enumerate
-
-@item extglob
-If set, the extended pattern matching features described above
-(@pxref{Pattern Matching}) are enabled.
-
-@item extquote
-If set, @code{$'@var{string}'} and @code{$"@var{string}"} quoting is  
-performed within @code{$@{@var{parameter}@}} expansions                     
-enclosed in double quotes.  This option is enabled by default. 
-
-@item failglob
-If set, patterns which fail to match filenames during pathname expansion
-result in an expansion error.
-
-@item force_fignore
-If set, the suffixes specified by the @env{FIGNORE} shell variable
-cause words to be ignored when performing word completion even if
-the ignored words are the only possible completions.
-@xref{Bash Variables}, for a description of @env{FIGNORE}.
-This option is enabled by default.
-
-@item gnu_errfmt
-If set, shell error messages are written in the standard @sc{gnu} error
-message format.
-
-@item histappend
-If set, the history list is appended to the file named by the value
-of the @env{HISTFILE}
-variable when the shell exits, rather than overwriting the file.
-
-@item histreedit
-If set, and Readline
-is being used, a user is given the opportunity to re-edit a
-failed history substitution.
-
-@item histverify
-If set, and Readline
-is being used, the results of history substitution are not immediately
-passed to the shell parser.  Instead, the resulting line is loaded into
-the Readline editing buffer, allowing further modification.
-
-@item hostcomplete
-If set, and Readline is being used, Bash will attempt to perform
-hostname completion when a word containing a @samp{@@} is being
-completed (@pxref{Commands For Completion}).  This option is enabled
-by default.
-
-@item huponexit
-If set, Bash will send @code{SIGHUP} to all jobs when an interactive
-login shell exits (@pxref{Signals}).
-
-@item interactive_comments
-Allow a word beginning with @samp{#}
-to cause that word and all remaining characters on that
-line to be ignored in an interactive shell.
-This option is enabled by default.
-
-@item lithist
-If enabled, and the @code{cmdhist}
-option is enabled, multi-line commands are saved to the history with
-embedded newlines rather than using semicolon separators where possible.
-
-@item login_shell
-The shell sets this option if it is started as a login shell
-(@pxref{Invoking Bash}).
-The value may not be changed.
-
-@item mailwarn
-If set, and a file that Bash is checking for mail has been  
-accessed since the last time it was checked, the message
-@code{"The mail in @var{mailfile} has been read"} is displayed.
-
-@item no_empty_cmd_completion
-If set, and Readline is being used, Bash will not attempt to search
-the @env{PATH} for possible completions when completion is attempted
-on an empty line.
-
-@item nocaseglob
-If set, Bash matches filenames in a case-insensitive fashion when
-performing filename expansion.
-
-@item nocasematch
-If set, Bash matches patterns in a case-insensitive fashion when
-performing matching while executing @code{case} or @code{[[}
-conditional commands.
-
-@item nullglob
-If set, Bash allows filename patterns which match no
-files to expand to a null string, rather than themselves.
-
-@item progcomp
-If set, the programmable completion facilities
-(@pxref{Programmable Completion}) are enabled.
-This option is enabled by default.
-
-@item promptvars
-If set, prompt strings undergo
-parameter expansion, command substitution, arithmetic
-expansion, and quote removal after being expanded
-as described below (@pxref{Printing a Prompt}).
-This option is enabled by default.
-
-@item restricted_shell
-The shell sets this option if it is started in restricted mode
-(@pxref{The Restricted Shell}).
-The value may not be changed.
-This is not reset when the startup files are executed, allowing
-the startup files to discover whether or not a shell is restricted.
-
-@item shift_verbose
-If this is set, the @code{shift}
-builtin prints an error message when the shift count exceeds the
-number of positional parameters.
-
-@item sourcepath
-If set, the @code{source} builtin uses the value of @env{PATH}
-to find the directory containing the file supplied as an argument.
-This option is enabled by default.
-
-@item xpg_echo
-If set, the @code{echo} builtin expands backslash-escape sequences
-by default.
 
-@end table
+Read lines from the standard input into the indexed array variable @var{array},
+or from file descriptor @var{fd}
+if the @option{-u} option is supplied.
 
-@noindent
-The return status when listing options is zero if all @var{optnames}
-are enabled, non-zero otherwise.
-When setting or unsetting options, the return status is zero unless an
-@var{optname} is not a valid shell option.
+A synonym for @code{mapfile}.
 
 @item source
 @btindex source
 @example
 source @var{filename}
 @end example
+
 A synonym for @code{.} (@pxref{Bourne Shell Builtins}).
 
 @item type
@@ -3789,6 +4388,7 @@ A synonym for @code{.} (@pxref{Bourne Shell Builtins}).
 @example
 type [-afptP] [@var{name} @dots{}]
 @end example
+
 For each @var{name}, indicate how it would be interpreted if used as a
 command name.
 
@@ -3808,7 +4408,7 @@ The @option{-P} option forces a path search for each @var{name}, even if
 @option{-t} would not return @samp{file}.
 
 If a command is hashed, @option{-p} and @option{-P} print the hashed value,
-not necessarily the file that appears first in @code{$PATH}.
+which is not necessarily the file that appears first in @code{$PATH}.
 
 If the @option{-a} option is used, @code{type} returns all of the places
 that contain an executable named @var{file}.
@@ -3818,26 +4418,29 @@ is not also used.
 If the @option{-f} option is used, @code{type} does not attempt to find
 shell functions, as with the @code{command} builtin.
 
-The return status is zero if any of the @var{names} are found, non-zero
-if none are found.
+The return status is zero if all of the @var{names} are found, non-zero
+if any are not found.
 
 @item typeset
 @btindex typeset
 @example
-typeset [-afFrxi] [-p] [@var{name}[=@var{value}] @dots{}]
+typeset [-afFgrxilnrtux] [-p] [@var{name}[=@var{value}] @dots{}]
 @end example
+
 The @code{typeset} command is supplied for compatibility with the Korn
-shell; however, it has been deprecated in favor of the @code{declare}
-builtin command.
+shell.
+It is a synonym for the @code{declare} builtin command.
 
 @item ulimit
 @btindex ulimit
 @example
-ulimit [-acdflmnpstuvSH] [@var{limit}]
+ulimit [-abcdefilmnpqrstuvxHST] [@var{limit}]
 @end example
+
 @code{ulimit} provides control over the resources available to processes
 started by the shell, on systems that allow such control.  If an
 option is given, it is interpreted as follows:
+
 @table @code
 @item -S
 Change and report the soft limit associated with a resource.
@@ -3848,27 +4451,43 @@ Change and report the hard limit associated with a resource.
 @item -a
 All current limits are reported.
 
-@item -c
+@item -b
+The maximum socket buffer size.
+
+@item -c
 The maximum size of core files created.
 
 @item -d
 The maximum size of a process's data segment.
 
+@item -e
+The maximum scheduling priority ("nice").
+
 @item -f
-The maximum size of files created by the shell.
+The maximum size of files written by the shell and its children.
+
+@item -i
+The maximum number of pending signals.
 
 @item -l
 The maximum size that may be locked into memory.
 
 @item -m
-The maximum resident set size.
+The maximum resident set size (many systems do not honor this limit).
 
 @item -n
-The maximum number of open file descriptors.
+The maximum number of open file descriptors (most systems do not
+allow this value to be set).
 
 @item -p
 The pipe buffer size.
 
+@item -q
+The maximum number of bytes in POSIX message queues.
+
+@item -r
+The maximum real-time scheduling priority.
+
 @item -s
 The maximum stack size.
 
@@ -3879,22 +4498,31 @@ The maximum amount of cpu time in seconds.
 The maximum number of processes available to a single user.
 
 @item -v
-The maximum amount of virtual memory available to the process.
+The maximum amount of virtual memory available to the shell, and, on
+some systems, to its children.
+
+@item -x
+The maximum number of file locks.
 
+@item -T
+The maximum number of threads.
 @end table
 
-If @var{limit} is given, it is the new value of the specified resource;
-the special @var{limit} values @code{hard}, @code{soft}, and
+If @var{limit} is given, and the @option{-a} option is not used,
+@var{limit} is the new value of the specified resource.
+The special @var{limit} values @code{hard}, @code{soft}, and
 @code{unlimited} stand for the current hard limit, the current soft limit,
 and no limit, respectively.
+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.
 Otherwise, the current value of the soft limit for the specified resource
 is printed, unless the @option{-H} option is supplied.
 When setting new limits, if neither @option{-H} nor @option{-S} is supplied,
 both the hard and soft limits are set.
 If no option is given, then @option{-f} is assumed.  Values are in 1024-byte
-increments, except for @option{-t}, which is in seconds, @option{-p},
-which is in units of 512-byte blocks, and @option{-n} and @option{-u}, which
-are unscaled values.
+increments, except for @option{-t}, which is in seconds; @option{-p},
+which is in units of 512-byte blocks; and @option{-T}, @option{-b},
+@option{-n} and @option{-u}, which are unscaled values.
 
 The return status is zero unless an invalid option or argument is supplied,
 or an error occurs while setting a new limit.
@@ -3908,19 +4536,30 @@ unalias [-a] [@var{name} @dots{} ]
 Remove each @var{name} from the list of aliases.  If @option{-a} is
 supplied, all aliases are removed.
 Aliases are described in @ref{Aliases}.
-
 @end table
 
+@node Modifying Shell Behavior
+@section Modifying Shell Behavior
+@menu
+* The Set Builtin::            Change the values of shell attributes and
+                               positional parameters.
+* The Shopt Builtin::          Modify shell optional behavior.
+@end menu
+
 @node The Set Builtin
-@section The Set Builtin
+@subsection The Set Builtin
 
-This builtin is so complicated that it deserves its own section.
+This builtin is so complicated that it deserves its own section.  @code{set}
+allows you to change the values of shell options and set the positional
+parameters, or to display the names and values of shell variables.
 
 @table @code
 @item set
 @btindex set
 @example
-set [--abefhkmnptuvxBCHP] [-o @var{option}] [@var{argument} @dots{}]
+set [--abefhkmnptuvxBCEHPT] [-o @var{option-name}] [@var{argument} @dots{}]
+set [+abefhkmnptuvxBCEHPT] [+o @var{option-name}] [@var{argument} @dots{}]
 @end example
 
 If no options or arguments are supplied, @code{set} displays the names
@@ -3943,16 +4582,40 @@ Cause the status of terminated background jobs to be reported
 immediately, rather than before printing the next primary prompt.
 
 @item -e
-Exit immediately if a simple command (@pxref{Simple Commands}) exits
-with a non-zero status, unless the command that fails is part of the
-command list immediately following a @code{while} or @code{until}
-keyword, part of the test in an @code{if} statement,
-part of a @code{&&} or @code{||} list, or if the command's return
-status is being inverted using @code{!}.
+Exit immediately if
+a pipeline (@pxref{Pipelines}), which may consist of a single simple command
+(@pxref{Simple Commands}),
+a list (@pxref{Lists}),
+or a compound command (@pxref{Compound Commands})
+returns a non-zero status.
+The shell does not exit if the command that fails is part of the
+command list immediately following a @code{while} or @code{until} keyword,
+part of the test in an @code{if} statement,
+part of any command executed in a @code{&&} or @code{||} list except
+the command following the final @code{&&} or @code{||},
+any command in a pipeline but the last,
+or if the command's return status is being inverted with @code{!}.
+If a compound command other than a subshell
+returns a non-zero status because a command failed
+while @option{-e} was being ignored, the shell does not exit.
 A trap on @code{ERR}, if set, is executed before the shell exits.
 
+This option applies to the shell environment and each subshell environment
+separately (@pxref{Command Execution Environment}), and may cause
+subshells to exit before executing all the commands in the subshell.
+
+If a compound command or shell function executes in a context where
+@option{-e} is being ignored,
+none of the commands executed within the compound command or function body
+will be affected by the @option{-e} setting, even if @option{-e} is set
+and a command returns a failure status.
+If a compound command or shell function sets @option{-e} while executing in
+a context where @option{-e} is ignored, that setting will not have any
+effect until the compound command or the command containing the function
+call completes.
+
 @item -f
-Disable file name generation (globbing).
+Disable filename expansion (globbing).
 
 @item -h
 Locate and remember (hash) commands as they are looked up for execution.
@@ -3965,6 +4628,9 @@ the command name.
 
 @item -m
 Job control is enabled (@pxref{Job Control}).
+All processes run in a separate process group.
+When a background job completes, the shell prints a line
+containing its exit status.
 
 @item -n
 Read commands but do not execute them; this may be used to check a
@@ -3984,6 +4650,7 @@ Same as @code{-B}.
 
 @item emacs
 Use an @code{emacs}-style line editing interface (@pxref{Command Line Editing}).
+This also affects the editing interface used for @code{read -e}.
 
 @item errexit
 Same as @code{-e}.
@@ -4045,7 +4712,7 @@ This option is disabled by default.
 
 @item posix
 Change the behavior of Bash where the default operation differs
-from the @sc{posix} 1003.2 standard to match the standard
+from the @sc{posix} standard to match the standard
 (@pxref{Bash POSIX Mode}).
 This is intended to make Bash behave as a strict superset of that
 standard.
@@ -4058,6 +4725,7 @@ Same as @code{-v}.
 
 @item vi
 Use a @code{vi}-style line editing interface.
+This also affects the editing interface used for @code{read -e}.
 
 @item xtrace
 Same as @code{-x}.
@@ -4067,12 +4735,12 @@ Same as @code{-x}.
 Turn on privileged mode.
 In this mode, the @env{$BASH_ENV} and @env{$ENV} files are not
 processed, shell functions are not inherited from the environment,
-and the @env{SHELLOPTS} variable, if it appears in the environment,
-is ignored.
+and the @env{SHELLOPTS}, @env{BASHOPTS}, @env{CDPATH} and @env{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 @code{-p} option is not supplied, these actions
+real user (group) id, and the @option{-p} option is not supplied, these actions
 are taken and the effective user id is set to the real user id.
-If the @code{-p} option is supplied at startup, the effective user id is
+If the @option{-p} option is supplied at startup, the effective user id is
 not reset.
 Turning this option off causes the effective user
 and group ids to be set to the real user and group ids.
@@ -4081,7 +4749,8 @@ and group ids to be set to the real user and group ids.
 Exit after reading and executing one command.
 
 @item -u
-Treat unset variables as an error when performing parameter expansion.
+Treat unset variables and parameters other than the special parameters
+@samp{@@} or @samp{*} as an error when performing parameter expansion.
 An error message will be written to the standard error, and a non-interactive
 shell will exit.
 
@@ -4089,8 +4758,8 @@ shell will exit.
 Print shell input lines as they are read.
 
 @item -x
-Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP
-commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands
+Print a trace of simple commands, @code{for} commands, @code{case}
+commands, @code{select} commands, and arithmetic @code{for} commands
 and their arguments or associated word lists after they are
 expanded and before they are executed.  The value of the @env{PS4}
 variable is expanded and the resultant value is printed before
@@ -4100,79 +4769,445 @@ the command and its expanded arguments.
 The shell will perform brace expansion (@pxref{Brace Expansion}).
 This option is on by default.
 
-@item -C
-Prevent output redirection using @samp{>}, @samp{>&}, and @samp{<>}
-from overwriting existing files.
+@item -C
+Prevent output redirection using @samp{>}, @samp{>&}, and @samp{<>}
+from overwriting existing files.
+
+@item -E
+If set, any trap on @code{ERR} is inherited by shell functions, command
+substitutions, and commands executed in a subshell environment.
+The @code{ERR} trap is normally not inherited in such cases.
+
+@item -H
+Enable @samp{!} style history substitution (@pxref{History Interaction}).
+This option is on by default for interactive shells.
+
+@item -P
+If set, do not resolve symbolic links when performing commands such as
+@code{cd} which change the current directory.  The physical directory
+is used instead.  By default, Bash follows
+the logical chain of directories when performing commands
+which change the current directory.
+
+For example, if @file{/usr/sys} is a symbolic link to @file{/usr/local/sys}
+then:
+@example
+$ cd /usr/sys; echo $PWD
+/usr/sys
+$ cd ..; pwd
+/usr
+@end example
+
+@noindent
+If @code{set -P} is on, then:
+@example
+$ cd /usr/sys; echo $PWD
+/usr/local/sys
+$ cd ..; pwd
+/usr/local
+@end example
+
+@item -T
+If set, any trap on @code{DEBUG} and @code{RETURN} are inherited by
+shell functions, command substitutions, and commands executed
+in a subshell environment.
+The @code{DEBUG} and @code{RETURN} traps are normally not inherited
+in such cases.
+
+@item --
+If no arguments follow this option, then the positional parameters are
+unset.  Otherwise, the positional parameters are set to the
+@var{arguments}, even if some of them begin with a @samp{-}.
+
+@item -
+Signal the end of options, cause all remaining @var{arguments}
+to be assigned to the positional parameters.  The @option{-x}
+and @option{-v}  options are turned off.
+If there are no arguments, the positional parameters remain unchanged.
+@end table
+
+Using @samp{+} rather than @samp{-} causes these options to be
+turned off.  The options can also be used upon invocation of the
+shell.  The current set of options may be found in @code{$-}.
+
+The remaining N @var{arguments} are positional parameters and are
+assigned, in order, to @code{$1}, @code{$2}, @dots{}  @code{$N}.
+The special parameter @code{#} is set to N.
+
+The return status is always zero unless an invalid option is supplied.
+@end table
+
+@node The Shopt Builtin
+@subsection The Shopt Builtin
+
+This builtin allows you to change additional shell optional behavior.
+
+@table @code
+
+@item shopt
+@btindex shopt
+@example
+shopt [-pqsu] [-o] [@var{optname} @dots{}]
+@end example
+
+Toggle the values of settings controlling optional shell behavior.
+The settings can be either those listed below, or, if the
+@option{-o} option is used, those available with the @option{-o}
+option to the @code{set} builtin command (@pxref{The Set Builtin}).
+With no options, or with the @option{-p} option, a list of all settable
+options is displayed, with an indication of whether or not each is set.
+The @option{-p} option causes output to be displayed in a form that
+may be reused as input.
+Other options have the following meanings:
+
+@table @code
+@item -s
+Enable (set) each @var{optname}.
+
+@item -u
+Disable (unset) each @var{optname}.
+
+@item -q
+Suppresses normal output; the return status
+indicates whether the @var{optname} is set or unset.
+If multiple @var{optname} arguments are given with @option{-q},
+the return status is zero if all @var{optnames} are enabled;
+non-zero otherwise.
+
+@item -o
+Restricts the values of
+@var{optname} to be those defined for the @option{-o} option to the
+@code{set} builtin (@pxref{The Set Builtin}).
+@end table
+
+If either @option{-s} or @option{-u}
+is used with no @var{optname} arguments, @code{shopt} shows only
+those options which are set or unset, respectively.
+
+Unless otherwise noted, the @code{shopt} options are disabled (off)
+by default.
+
+The return status when listing options is zero if all @var{optnames}
+are enabled, non-zero otherwise.  When setting or unsetting options,
+the return status is zero unless an @var{optname} is not a valid shell
+option.
+
+The list of @code{shopt} options is:
+@table @code
+
+@item autocd
+If set, a command name that is the name of a directory is executed as if
+it were the argument to the @code{cd} command.
+This option is only used by interactive shells.
+
+@item cdable_vars
+If this is set, an argument to the @code{cd} builtin command that
+is not a directory is assumed to be the name of a variable whose
+value is the directory to change to.
+
+@item cdspell
+If set, minor errors in the spelling of a directory component in a
+@code{cd} command will be corrected.
+The errors checked for are transposed characters,
+a missing character, and a character too many.
+If a correction is found, the corrected path is printed,
+and the command proceeds.
+This option is only used by interactive shells.
+
+@item checkhash
+If this is set, Bash 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.
+
+@item checkjobs
+If set, Bash 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 (@pxref{Job Control}).
+The shell always postpones exiting if any jobs are stopped.
+
+@item checkwinsize
+If set, Bash checks the window size after each command
+ and, if necessary, updates the values of    
+@env{LINES} and @env{COLUMNS}.
+
+@item cmdhist
+If set, Bash
+attempts to save all lines of a multiple-line
+command in the same history entry.  This allows
+easy re-editing of multi-line commands.
+
+@item compat31
+If set, Bash
+changes its behavior to that of version 3.1 with respect to quoted
+arguments to the conditional command's @samp{=~} operator
+and with respect to locale-specific
+string comparison when using the @code{[[}
+conditional command's @samp{<} and @samp{>} operators.
+Bash versions prior to bash-4.1 use ASCII collation and strcmp(3);
+bash-4.1 and later use the current locale's collation sequence and strcoll(3).
+
+@item compat32
+If set, Bash
+changes its behavior to that of version 3.2 with respect to locale-specific
+string comparison when using the @code{[[}
+conditional command's @samp{<} and @samp{>} operators (see previous item).
+
+@item compat40
+If set, Bash
+changes its behavior to that of version 4.0 with respect to locale-specific
+string comparison when using the @code{[[}
+conditional command's @samp{<} and @samp{>} operators (see description
+of @code{compat31})
+and the effect of interrupting a command list.
+Bash versions 4.0 and later interrupt the list as if the shell received the
+interrupt; previous versions continue with the next command in the list.
+
+@item compat41
+If set, Bash, when in @sc{posix} mode, treats a single quote in a double-quoted
+parameter expansion as a special character.  The single quotes must match
+(an even number) and the characters between the single quotes are considered
+quoted.  This is the behavior of @sc{posix} mode through version 4.1.
+The default Bash behavior remains as in previous versions.
+
+@item compat42
+If set, Bash
+does not process the replacement string in the pattern substitution word
+expansion using quote removal.
+
+@item complete_fullquote
+If set, Bash
+quotes all shell metacharacters in filenames and directory names when
+performing completion.
+If not set, Bash
+removes metacharacters such as the dollar sign from the set of
+characters that will be quoted in completed filenames
+when these metacharacters appear in shell variable references in words to be
+completed.
+This means that dollar signs in variable names that expand to directories
+will not be quoted;
+however, any dollar signs appearing in filenames will not be quoted, either.
+This is active only when bash is using backslashes to quote completed
+filenames.
+This variable is set by default, which is the default Bash behavior in
+versions through 4.2.
+
+@item direxpand
+If set, Bash
+replaces directory names with the results of word expansion when performing
+filename completion.  This changes the contents of the readline editing
+buffer.
+If not set, Bash attempts to preserve what the user typed.
+
+@item dirspell
+If set, Bash
+attempts spelling correction on directory names during word completion 
+if the directory name initially supplied does not exist.
+
+@item dotglob
+If set, Bash includes filenames beginning with a `.' in
+the results of filename expansion.
+
+@item execfail
+If this is set, a non-interactive shell will not exit if
+it cannot execute the file specified as an argument to the @code{exec}
+builtin command.  An interactive shell does not exit if @code{exec}
+fails.
+
+@item expand_aliases
+If set, aliases are expanded as described below under Aliases,
+@ref{Aliases}.
+This option is enabled by default for interactive shells.
+
+@item extdebug
+If set, behavior intended for use by debuggers is enabled:
+
+@enumerate
+@item
+The @option{-F} option to the @code{declare} builtin (@pxref{Bash Builtins})
+displays the source file name and line number corresponding to each function
+name supplied as an argument.
+
+@item
+If the command run by the @code{DEBUG} trap returns a non-zero value, the
+next command is skipped and not executed.
+
+@item
+If the command run by the @code{DEBUG} trap returns a value of 2, and the
+shell is executing in a subroutine (a shell function or a shell script
+executed by the @code{.} or @code{source} builtins), a call to
+@code{return} is simulated.
+
+@item
+@code{BASH_ARGC} and @code{BASH_ARGV} are updated as described in their
+descriptions (@pxref{Bash Variables}).
+
+@item
+Function tracing is enabled:  command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{DEBUG} and @code{RETURN} traps.
+
+@item
+Error tracing is enabled:  command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{ERR} trap.
+@end enumerate
+
+@item extglob
+If set, the extended pattern matching features described above
+(@pxref{Pattern Matching}) are enabled.
+
+@item extquote
+If set, @code{$'@var{string}'} and @code{$"@var{string}"} quoting is  
+performed within @code{$@{@var{parameter}@}} expansions                     
+enclosed in double quotes.  This option is enabled by default. 
+
+@item failglob
+If set, patterns which fail to match filenames during filename expansion
+result in an expansion error.
+
+@item force_fignore
+If set, the suffixes specified by the @env{FIGNORE} shell variable
+cause words to be ignored when performing word completion even if
+the ignored words are the only possible completions.
+@xref{Bash Variables}, for a description of @env{FIGNORE}.
+This option is enabled by default.
+
+@item globasciiranges
+If set, range expressions used in pattern matching bracket expressions
+(@pxref{Pattern Matching})
+behave as if in the traditional C locale when performing
+comparisons.  That is, the current locale's collating sequence
+is not taken into account, so
+@samp{b} will not collate between @samp{A} and @samp{B},
+and upper-case and lower-case ASCII characters will collate together.   
+
+@item globstar
+If set, the pattern @samp{**} used in a filename expansion context will
+match all files and zero or more directories and subdirectories.
+If the pattern is followed by a @samp{/}, only directories and
+subdirectories match.
+
+@item gnu_errfmt
+If set, shell error messages are written in the standard @sc{gnu} error
+message format.
+
+@item histappend
+If set, the history list is appended to the file named by the value
+of the @env{HISTFILE}
+variable when the shell exits, rather than overwriting the file.
+
+@item histreedit
+If set, and Readline
+is being used, a user is given the opportunity to re-edit a
+failed history substitution.
+
+@item histverify
+If set, and Readline
+is being used, the results of history substitution are not immediately
+passed to the shell parser.  Instead, the resulting line is loaded into
+the Readline editing buffer, allowing further modification.
+
+@item hostcomplete
+If set, and Readline is being used, Bash will attempt to perform
+hostname completion when a word containing a @samp{@@} is being
+completed (@pxref{Commands For Completion}).  This option is enabled
+by default.
+
+@item huponexit
+If set, Bash will send @code{SIGHUP} to all jobs when an interactive
+login shell exits (@pxref{Signals}).
+
+@item interactive_comments
+Allow a word beginning with @samp{#}
+to cause that word and all remaining characters on that
+line to be ignored in an interactive shell.
+This option is enabled by default.
+
+@item lastpipe
+If set, and job control is not active, the shell runs the last command of
+a pipeline not executed in the background in the current shell environment.
+
+@item lithist
+If enabled, and the @code{cmdhist}
+option is enabled, multi-line commands are saved to the history with
+embedded newlines rather than using semicolon separators where possible.
+
+@item login_shell
+The shell sets this option if it is started as a login shell
+(@pxref{Invoking Bash}).
+The value may not be changed.
+
+@item mailwarn
+If set, and a file that Bash is checking for mail has been  
+accessed since the last time it was checked, the message
+@code{"The mail in @var{mailfile} has been read"} is displayed.
+
+@item no_empty_cmd_completion
+If set, and Readline is being used, Bash will not attempt to search
+the @env{PATH} for possible completions when completion is attempted
+on an empty line.
 
-@item -E
-If set, any trap on @code{ERR} is inherited by shell functions, command
-substitutions, and commands executed in a subshell environment.
-The @code{ERR} trap is normally not inherited in such cases.
+@item nocaseglob
+If set, Bash matches filenames in a case-insensitive fashion when
+performing filename expansion.
 
-@item -H
-Enable @samp{!} style history substitution (@pxref{History Interaction}).
-This option is on by default for interactive shells.
+@item nocasematch
+If set, Bash matches patterns in a case-insensitive fashion when
+performing matching while executing @code{case} or @code{[[}
+conditional commands.
 
-@item -P
-If set, do not follow symbolic links when performing commands such as
-@code{cd} which change the current directory.  The physical directory
-is used instead.  By default, Bash follows
-the logical chain of directories when performing commands
-which change the current directory.
+@item nullglob
+If set, Bash allows filename patterns which match no
+files to expand to a null string, rather than themselves.
 
-For example, if @file{/usr/sys} is a symbolic link to @file{/usr/local/sys}
-then:
-@example
-$ cd /usr/sys; echo $PWD
-/usr/sys
-$ cd ..; pwd
-/usr
-@end example
+@item progcomp
+If set, the programmable completion facilities
+(@pxref{Programmable Completion}) are enabled.
+This option is enabled by default.
 
-@noindent
-If @code{set -P} is on, then:
-@example
-$ cd /usr/sys; echo $PWD
-/usr/local/sys
-$ cd ..; pwd
-/usr/local
-@end example
+@item promptvars
+If set, prompt strings undergo
+parameter expansion, command substitution, arithmetic
+expansion, and quote removal after being expanded
+as described below (@pxref{Controlling the Prompt}).
+This option is enabled by default.
 
-@item -T
-If set, any trap on @code{DEBUG} and @code{RETURN} are inherited by
-shell functions, command substitutions, and commands executed
-in a subshell environment.
-The @code{DEBUG} and @code{RETURN} traps are normally not inherited
-in such cases.
+@item restricted_shell
+The shell sets this option if it is started in restricted mode
+(@pxref{The Restricted Shell}).
+The value may not be changed.
+This is not reset when the startup files are executed, allowing
+the startup files to discover whether or not a shell is restricted.
 
-@item --
-If no arguments follow this option, then the positional parameters are
-unset.  Otherwise, the positional parameters are set to the
-@var{arguments}, even if some of them begin with a @samp{-}.
+@item shift_verbose
+If this is set, the @code{shift}
+builtin prints an error message when the shift count exceeds the
+number of positional parameters.
 
-@item -
-Signal the end of options, cause all remaining @var{arguments}
-to be assigned to the positional parameters.  The @option{-x}
-and @option{-v}  options are turned off.
-If there are no arguments, the positional parameters remain unchanged.
-@end table
+@item sourcepath
+If set, the @code{source} builtin uses the value of @env{PATH}
+to find the directory containing the file supplied as an argument.
+This option is enabled by default.
 
-Using @samp{+} rather than @samp{-} causes these options to be
-turned off.  The options can also be used upon invocation of the
-shell.  The current set of options may be found in @code{$-}.
+@item xpg_echo
+If set, the @code{echo} builtin expands backslash-escape sequences
+by default.
 
-The remaining N @var{arguments} are positional parameters and are
-assigned, in order, to @code{$1}, @code{$2}, @dots{}  @code{$N}.
-The special parameter @code{#} is set to N.
+@end table
 
-The return status is always zero unless an invalid option is supplied.
+@noindent
+The return status when listing options is zero if all @var{optnames}
+are enabled, non-zero otherwise.
+When setting or unsetting options, the return status is zero unless an
+@var{optname} is not a valid shell option.
 @end table
 
 @node Special Builtins
 @section Special Builtins
 @cindex special builtin
 
-For historical reasons, the @sc{posix} 1003.2 standard has classified
+For historical reasons, the @sc{posix} standard has classified
 several builtin commands as @emph{special}.
 When Bash is executing in @sc{posix} mode, the special builtins
 differ from other builtin commands in three respects:
@@ -4234,15 +5269,16 @@ A list of characters that separate fields; used when the shell splits
 words as part of expansion.
 
 @item MAIL
-If this parameter is set to a filename and the @env{MAILPATH} variable
+If this parameter is set to a filename or directory name
+and the @env{MAILPATH} variable
 is not set, Bash informs the user of the arrival of mail in
-the specified file.
+the specified file or Maildir-format directory.
 
 @item MAILPATH
 A colon-separated list of filenames which the shell periodically checks
 for new mail.
 Each list entry can specify the message that is printed when new mail
-arrives in the mail file by separating the file name from the message with
+arrives in the mail file by separating the filename from the message with
 a @samp{?}.
 When used in the text of the message, @code{$_} expands to the name of
 the current mail file.
@@ -4264,7 +5300,7 @@ or trailing colon.
 
 @item PS1
 The primary prompt string.  The default value is @samp{\s-\v\$ }.
-@xref{Printing a Prompt}, for the complete list of escape
+@xref{Controlling the Prompt}, for the complete list of escape
 sequences that are expanded before @env{PS1} is displayed.
 
 @item PS2
@@ -4287,6 +5323,28 @@ variables for controlling the job control facilities
 @item BASH
 The full pathname used to execute the current instance of Bash.
 
+@item BASHOPTS
+A colon-separated list of enabled shell options.  Each word in
+the list is a valid argument for the @option{-s} option to the
+@code{shopt} builtin command (@pxref{The Shopt Builtin}).
+The options appearing in @env{BASHOPTS} are those reported
+as @samp{on} by @samp{shopt}.
+If this variable is in the environment when Bash
+starts up, each shell option in the list will be enabled before
+reading any startup files.  This variable is readonly.
+
+@item BASHPID
+Expands to the process ID of the current Bash process.
+This differs from @code{$$} under certain circumstances, such as subshells
+that do not require Bash to be re-initialized.
+
+@item BASH_ALIASES
+An associative array variable whose members correspond to the internal
+list of aliases as maintained by the @code{alias} builtin.
+(@pxref{Bourne Shell Builtins}).
+Elements added to this array appear in the alias list; unsetting array
+elements cause aliases to be removed from the alias list.
+
 @item BASH_ARGC
 An array variable whose values are the number of parameters in each
 frame of the current bash execution call stack.  The number of
@@ -4295,7 +5353,7 @@ with @code{.} or @code{source}) is at the top of the stack.  When a
 subroutine is executed, the number of parameters passed is pushed onto
 @code{BASH_ARGC}.
 The shell sets @code{BASH_ARGC} only when in extended debugging mode
-(see @ref{Bash Builtins}  
+(see @ref{The Shopt Builtin}
 for a description of the @code{extdebug} option to the @code{shopt}
 builtin).
 
@@ -4306,15 +5364,38 @@ 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 @code{BASH_ARGV}.
 The shell sets @code{BASH_ARGV} only when in extended debugging mode
-(see @ref{Bash Builtins}  
+(see @ref{The Shopt Builtin}
 for a description of the @code{extdebug} option to the @code{shopt}
 builtin).
 
+@item BASH_CMDS
+An associative array variable whose members correspond to the internal
+hash table of commands as maintained by the @code{hash} builtin
+(@pxref{Bourne Shell Builtins}).
+Elements added to this array appear in the hash table; unsetting array
+elements cause commands to be removed from the hash table.
+
 @item 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,
 in which case it is the command executing at the time of the trap.
 
+@item BASH_COMPAT
+The value is used to set the shell's compatibility level.
+@xref{The Shopt Builtin}, for a description of the various compatibility
+levels and their effects.
+The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
+corresponding to the desired compatibility level.
+If @code{BASH_COMPAT} is unset or set to the empty string, the compatibility
+level is set to the default for the current version.
+If @code{BASH_COMPAT} is set to a value that is not one of the valid
+compatibility levels, the shell prints an error message and sets the
+compatibility level to the default for the current version.
+The valid compatibility levels correspond to the compatibility options
+accepted by the @code{shopt} builtin described above (for example,
+@var{compat42} means that 4.2 and 42 are valid values).
+The current version is also a valid value.
+
 @item BASH_ENV
 If this variable is set when Bash is invoked to execute a shell
 script, its value is expanded and used as the name of a startup file
@@ -4325,10 +5406,11 @@ The command argument to the @option{-c} invocation option.
 
 @item BASH_LINENO
 An array variable whose members are the line numbers in source files
-corresponding to each member of @var{FUNCNAME}.
-@code{$@{BASH_LINENO[$i]@}} is the line number in the source file where
-@code{$@{FUNCNAME[$i]@}} was called.
-The corresponding source file name is @code{$@{BASH_SOURCE[$i]@}}.
+where each corresponding member of @var{FUNCNAME} was invoked.
+@code{$@{BASH_LINENO[$i]@}} is the line number in the source file
+(@code{$@{BASH_SOURCE[$i+1]@}}) where
+@code{$@{FUNCNAME[$i]@}} was called (or @code{$@{BASH_LINENO[$i-1]@}} if
+referenced within another shell function). 
 Use @code{LINENO} to obtain the current line number.
 
 @item BASH_REMATCH
@@ -4342,11 +5424,15 @@ string matching the @var{n}th parenthesized subexpression.
 This variable is read-only.
 
 @item BASH_SOURCE
-An array variable whose members are the source filenames corresponding
-to the elements in the @code{FUNCNAME} array variable.
+An array variable whose members are the source filenames where the
+corresponding shell function names in the @code{FUNCNAME} array
+variable are defined.
+The shell function @code{$@{FUNCNAME[$i]@}} is defined in the file
+@code{$@{BASH_SOURCE[$i]@}} and called from @code{$@{BASH_SOURCE[$i+1]@}}
 
 @item BASH_SUBSHELL
-Incremented by one each time a subshell or subshell environment is spawned.
+Incremented by one within each subshell or subshell environment when
+the shell begins executing in that environment.
 The initial value is 0.
 
 @item BASH_VERSINFO
@@ -4373,15 +5459,37 @@ The release status (e.g., @var{beta1}).
 
 @item BASH_VERSINFO[5]
 The value of @env{MACHTYPE}.
-
 @end table
 
 @item BASH_VERSION
 The version number of the current instance of Bash.
 
+@item BASH_XTRACEFD
+If set to an integer corresponding to a valid file descriptor, Bash
+will write the trace output generated when @samp{set -x}
+is enabled to that file descriptor.
+This allows tracing output to be separated from diagnostic and error
+messages.
+The file descriptor is closed when @code{BASH_XTRACEFD} is unset or assigned
+a new value.
+Unsetting @code{BASH_XTRACEFD} or assigning it the empty string causes the
+trace output to be sent to the standard error.
+Note that setting @code{BASH_XTRACEFD} to 2 (the standard error file
+descriptor) and then unsetting it will result in the standard error
+being closed.
+
+@item CHILD_MAX
+Set the number of exited child status values for the shell to remember.
+Bash will not allow this value to be decreased below a @sc{posix}-mandated
+minimum, and there is a maximum value (currently 8192) that this may
+not exceed.
+The minimum value is system-dependent.
+
 @item COLUMNS
-Used by the @code{select} builtin command to determine the terminal width
-when printing selection lists.  Automatically set upon receipt of a
+Used by the @code{select} command to determine the terminal width
+when printing selection lists.
+Automatically set if the @code{checkwinsize} option is enabled
+(@pxref{The Shopt Builtin}), or in an interactive shell upon receipt of a
 @code{SIGWINCH}.
 
 @item COMP_CWORD
@@ -4405,6 +5513,23 @@ This variable is available only in shell functions and external
 commands invoked by the
 programmable completion facilities (@pxref{Programmable Completion}).
 
+@item COMP_TYPE
+Set to an integer value corresponding to the type of completion attempted
+that caused a completion function to be called:
+@var{TAB}, for normal completion,
+@samp{?}, for listing completions after successive tabs,
+@samp{!}, for listing alternatives on partial word completion,
+@samp{@@}, to list completions if the word is not unmodified,
+or
+@samp{%}, for menu completion.
+This variable is available only in shell functions and external
+commands invoked by the
+programmable completion facilities (@pxref{Programmable Completion}).
+
+@item COMP_KEY
+The key (or final key of a key sequence) used to invoke the current
+completion function.
+
 @item COMP_WORDBREAKS
 The set of characters that the Readline library treats as word
 separators when performing word completion.
@@ -4414,6 +5539,8 @@ even if it is subsequently reset.
 @item COMP_WORDS
 An array variable consisting of the individual
 words in the current command line.
+The line is split into words as Readline would split it, using
+@code{COMP_WORDBREAKS} as described above.
 This variable is available only in shell functions invoked by the
 programmable completion facilities (@pxref{Programmable Completion}).
 
@@ -4421,6 +5548,11 @@ programmable completion facilities (@pxref{Programmable Completion}).
 An array variable from which Bash reads the possible completions
 generated by a shell function invoked by the programmable completion
 facility (@pxref{Programmable Completion}).
+Each array element contains one possible completion.
+
+@item COPROC
+An array variable created to hold the file descriptors
+for output from and input to an unnamed coprocess (@pxref{Coprocesses}).
 
 @item DIRSTACK
 An array variable containing the current contents of the directory stack.
@@ -4436,7 +5568,11 @@ it is subsequently reset.
 @item EMACS
 If Bash finds this variable in the environment when the shell
 starts with value @samp{t}, it assumes that the shell is running in an
-emacs shell buffer and disables line editing.
+Emacs shell buffer and disables line editing.
+
+@item ENV
+Similar to @code{BASH_ENV}; used when the shell is invoked in
+@sc{posix} Mode (@pxref{Bash POSIX Mode}).
 
 @item EUID
 The numeric effective user id of the current user.  This variable
@@ -4449,9 +5585,9 @@ builtin command.
 @item FIGNORE
 A colon-separated list of suffixes to ignore when performing
 filename completion.
-A file name whose suffix matches one of the entries in 
+A filename whose suffix matches one of the entries in 
 @env{FIGNORE}
-is excluded from the list of matched file names.  A sample
+is excluded from the list of matched filenames.  A sample
 value is @samp{.o:~}
 
 @item FUNCNAME
@@ -4459,12 +5595,26 @@ 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 (the one with the highest index)
+is @code{"main"}.
 This variable exists only when a shell function is executing.
 Assignments to @env{FUNCNAME} have no effect and return an error status.
 If @env{FUNCNAME} is unset, it loses its special properties, even if
 it is subsequently reset.
 
+This variable can be used with @code{BASH_LINENO} and @code{BASH_SOURCE}.
+Each element of @code{FUNCNAME} has corresponding elements in
+@code{BASH_LINENO} and @code{BASH_SOURCE} to describe the call stack.
+For instance, @code{$@{FUNCNAME[$i]@}} was called from the file
+@code{$@{BASH_SOURCE[$i+1]@}} at line number @code{$@{BASH_LINENO[$i]@}}.
+The @code{caller} builtin displays the current call stack using this
+information.
+
+@item FUNCNEST
+If set to a numeric value greater than 0, defines a maximum function
+nesting level.  Function invocations that exceed this nesting level
+will cause the current command to abort.
+
 @item GLOBIGNORE
 A colon-separated list of patterns defining the set of filenames to
 be ignored by filename expansion.
@@ -4523,12 +5673,16 @@ The name of the file to which the command history is saved.  The
 default value is @file{~/.bash_history}.
 
 @item HISTFILESIZE
-The maximum number of lines contained in the history file.  When this
-variable is assigned a value, the history file is truncated, if
-necessary, to contain no more than that number of lines.
+The maximum number of lines contained in the history file.
+When this variable is assigned a value, the history file is truncated,
+if necessary, to contain no more than that number of lines
+by removing the oldest entries.
 The history file is also truncated to this size after
-writing it when an interactive shell exits.
-The default value is 500.
+writing it when a shell exits.
+If the value is 0, the history file is truncated to zero size.
+Non-numeric values and numeric values less than zero inhibit truncation.
+The shell sets the default value to the value of @env{HISTSIZE}
+after reading any startup files.
 
 @item HISTIGNORE
 A colon-separated list of patterns used to decide which command
@@ -4552,7 +5706,10 @@ provides the functionality of @code{ignoreboth}.
 
 @item HISTSIZE
 The maximum number of commands to remember on the history list.
-The default value is 500.
+If the value is 0, commands are not saved in the history list.
+Numeric values less than zero result in every command being saved
+on the history list (there is no limit).
+The shell sets the default value to 500 after reading any startup files.
 
 @item HISTTIMEFORMAT
 If this variable is set and not null, its value is used as a format string
@@ -4560,6 +5717,8 @@ for @var{strftime} to print the time stamp associated with each history
 entry displayed by the @code{history} builtin.
 If this variable is set, time stamps are written to the history file so
 they may be preserved across shell sessions.
+This uses the history comment character to distinguish timestamps from
+other history lines.
 
 @item HOSTFILE
 Contains the name of a file in the same format as @file{/etc/hosts} that
@@ -4569,7 +5728,8 @@ is running;
 the next time hostname completion is attempted after the
 value is changed, Bash adds the contents of the new file to the
 existing list.
-If @env{HOSTFILE} is set, but has no value, Bash attempts to read 
+If @env{HOSTFILE} is set, but has no value, or does not name a readable file,
+Bash attempts to read 
 @file{/etc/hosts} to obtain the list of possible hostname completions.
 When @env{HOSTFILE} is unset, the hostname list is cleared.
 
@@ -4624,8 +5784,10 @@ This variable determines the locale category used for number formatting.
 The line number in the script or shell function currently executing.
 
 @item LINES
-Used by the @code{select} builtin command to determine the column length
-for printing selection lists.  Automatically set upon receipt of a
+Used by the @code{select} command to determine the column length
+for printing selection lists.
+Automatically set if the @code{checkwinsize} option is enabled
+(@pxref{The Shopt Builtin}), or in an interactive shell upon receipt of a
 @code{SIGWINCH}.
 
 @item MACHTYPE
@@ -4640,6 +5802,10 @@ for mail, the shell does so before displaying the primary prompt.
 If this variable is unset, or set to a value that is not a number
 greater than or equal to zero, the shell disables mail checking.
 
+@item MAPFILE
+An array variable created to hold the text read by the
+@code{mapfile} builtin when no variable name is supplied.
+
 @item OLDPWD
 The previous working directory as set by the @code{cd} builtin.
 
@@ -4657,10 +5823,10 @@ in the most-recently-executed foreground pipeline (which may
 contain only a single command).
 
 @item POSIXLY_CORRECT
-If this variable is in the environment when @code{bash} starts, the shell
+If this variable is in the environment when Bash starts, the shell
 enters @sc{posix} mode (@pxref{Bash POSIX Mode}) before reading the
 startup files, as if the @option{--posix} invocation option had been supplied.
-If it is set while the shell is running, @code{bash} enables @sc{posix} mode,
+If it is set while the shell is running, Bash enables @sc{posix} mode,
 as if the command
 @example
 @code{set -o posix}
@@ -4676,6 +5842,12 @@ is readonly.
 If set, the value is interpreted as a command to execute
 before the printing of each primary prompt (@env{$PS1}).
 
+@item 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 @code{\w} and
+@code{\W} prompt string escapes (@pxref{Controlling the Prompt}).
+Characters removed are replaced with an ellipsis.
+
 @item PS3
 The value of this variable is used as the prompt for the
 @code{select} command.  If this variable is not set, the
@@ -4696,6 +5868,14 @@ Each time this parameter is referenced, a random integer
 between 0 and 32767 is generated.  Assigning a value to this
 variable seeds the random number generator.
 
+@item READLINE_LINE
+The contents of the Readline line buffer, for use
+with @samp{bind -x} (@pxref{Bash Builtins}).
+
+@item READLINE_POINT
+The position of the insertion point in the Readline line buffer, for use
+with @samp{bind -x} (@pxref{Bash Builtins}).
+
 @item REPLY
 The default variable for the @code{read} builtin.
 
@@ -4778,11 +5958,12 @@ The @code{select} command (@pxref{Conditional Constructs}) terminates
 if input does not arrive after @code{TMOUT} seconds when input is coming
 from a terminal.
 
-In an interative shell, the value is interpreted as
-the number of seconds to wait for input after issuing the primary
-prompt when the shell is interactive.
-Bash terminates after that number of seconds if input does
-not arrive.
+In an interactive shell, the value is interpreted as
+the number of seconds to wait for a line of input after issuing
+the primary prompt.
+Bash
+terminates after waiting for that number of seconds if a complete
+line of input does not arrive.
 
 @item TMPDIR
 If set, Bash uses its value as the name of a directory in which
@@ -4796,7 +5977,7 @@ The numeric real user id of the current user.  This variable is readonly.
 @node Bash Features
 @chapter Bash Features
 
-This section describes features unique to Bash.
+This chapter describes features unique to Bash.
 
 @menu
 * Invoking Bash::              Command line options that you can give
@@ -4809,7 +5990,7 @@ This section describes features unique to Bash.
 * Aliases::                    Substituting one command for another.
 * Arrays::                     Array Variables.
 * The Directory Stack::                History of visited directories.
-* Printing a Prompt::          Controlling the PS1 string.
+* Controlling the Prompt::     Customizing the various prompt strings.
 * The Restricted Shell::       A more controlled mode of shell execution.
 * Bash POSIX Mode::            Making Bash behave more closely to what
                                the POSIX standard specifies.
@@ -4824,19 +6005,18 @@ bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}]
 bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] [@var{argument} @dots{}]
 @end example
 
-In addition to the single-character shell command-line options
-(@pxref{The Set Builtin}), there are several multi-character
+All of the single-character options used with the @code{set} builtin
+(@pxref{The Set Builtin}) can be used as options when the shell is invoked.
+In addition, there are several multi-character
 options that you can use.  These options must appear on the command
 line before the single-character options to be recognized. 
 
 @table @code
 @item --debugger
 Arrange for the debugger profile to be executed before the shell
-starts.  Turns on extended debugging mode (see @ref{Bash Builtins}
+starts.  Turns on extended debugging mode (see @ref{The Shopt Builtin}
 for a description of the @code{extdebug} option to the @code{shopt}
-builtin) and shell function tracing
-(see @ref{The Set Builtin} for a description of the @code{-o functrace}
-option).
+builtin).
 
 @item --dump-po-strings
 A list of all double-quoted strings preceded by @samp{$}
@@ -4848,7 +6028,7 @@ Equivalent to @option{-D} except for the output format.
 Equivalent to @option{-D}.
 
 @item --help
-Display a usage message on standard output and exit sucessfully.
+Display a usage message on standard output and exit successfully.
 
 @item --init-file @var{filename}
 @itemx --rcfile @var{filename}
@@ -4875,7 +6055,7 @@ invoked as @code{sh}.
 
 @item --posix
 Change the behavior of Bash where the default operation differs
-from the @sc{posix} 1003.2 standard to match the standard.  This
+from the @sc{posix} standard to match the standard.  This
 is intended to make Bash behave as a strict superset of that
 standard.  @xref{Bash POSIX Mode}, for a description of the Bash
 @sc{posix} mode.
@@ -4889,16 +6069,16 @@ Equivalent to @option{-v}.  Print shell input lines as they're read.
 @item --version
 Show version information for this instance of
 Bash on the standard output and exit successfully.
-
 @end table
 
 There are several single-character options that may be supplied at
 invocation which are not available with the @code{set} builtin.
 
 @table @code
-@item -c @var{string}
-Read and execute commands from @var{string} after processing the
-options, then exit.  Any remaining arguments are assigned to the
+@item -c
+Read and execute commands from the first non-option @var{argument}
+after processing the options, then exit. 
+Any remaining arguments are assigned to the
 positional parameters, starting with @code{$0}.
 
 @item -i
@@ -4935,7 +6115,7 @@ This implies the @option{-n} option; no commands will be executed.
 
 @item [-+]O [@var{shopt_option}]
 @var{shopt_option} is one of the shell options accepted by the
-@code{shopt} builtin (@pxref{Shell Builtin Commands}).
+@code{shopt} builtin (@pxref{The Shopt Builtin}).
 If @var{shopt_option} is present, @option{-O} sets the value of that option;
 @option{+O} unsets it.  
 If @var{shopt_option} is not supplied, the names and values of the shell
@@ -4947,7 +6127,6 @@ that may be reused as input.
 A @code{--} signals the end of options and disables further option
 processing.
 Any arguments after the @code{--} are treated as filenames and arguments.
-
 @end table
 
 @cindex login shell
@@ -4977,9 +6156,9 @@ in the script.  If no commands are executed, the exit status is 0.
 @section Bash Startup Files
 @cindex startup files
 
-This section describs how Bash executes its startup files.
+This section describes how Bash executes its startup files.
 If any of the files exist but cannot be read, Bash reports an error.
-Tildes are expanded in file names as described above under
+Tildes are expanded in filenames as described above under
 Tilde Expansion (@pxref{Tilde Expansion}).
 
 Interactive shells are described in @ref{Interactive Shells}.
@@ -5025,7 +6204,7 @@ following command were executed:
 @end example
 @noindent
 but the value of the @env{PATH} variable is not used to search for the
-file name.
+filename.
 
 As noted above, if a non-interactive shell is invoked with the
 @option{--login} option, Bash attempts to read and execute commands from the
@@ -5066,24 +6245,27 @@ No other startup files are read.
 
 @subsubheading Invoked by remote shell daemon
 
-Bash attempts to determine when it is being run by the remote shell
-daemon, usually @code{rshd}.  If Bash determines it is being run by
-rshd, it reads and executes commands from @file{~/.bashrc}, if that
+Bash attempts to determine when it is being run with its standard input
+connected to a network connection, as when executed by the remote shell
+daemon, usually @code{rshd}, or the secure shell daemon @code{sshd}.
+If Bash determines it is being run in
+this fashion, it reads and executes commands from @file{~/.bashrc}, if that
 file exists and is readable.
 It will not do this if invoked as @code{sh}.
 The @option{--norc} option may be used to inhibit this behavior, and the
 @option{--rcfile} option may be used to force another file to be read, but
-@code{rshd} does not generally invoke the shell with those options or
-allow them to be specified.
+neither @code{rshd} nor @code{sshd} generally invoke the shell with those
+options or allow them to be specified.
 
 @subsubheading Invoked with unequal effective and real @sc{uid/gid}s
 
 If Bash is started with the effective user (group) id not equal to the
-real user (group) id, and the @code{-p} option is not supplied, no startup
+real user (group) id, and the @option{-p} option is not supplied, no startup
 files are read, shell functions are not inherited from the environment,
-the @env{SHELLOPTS} variable, if it appears in the environment, is ignored,
-and the effective user id is set to the real user id.
-If the @code{-p} option is supplied at invocation, the startup behavior is
+the @env{SHELLOPTS}, @env{BASHOPTS}, @env{CDPATH}, and @env{GLOBIGNORE}
+variables, if they appear in the environment, are ignored, and the effective
+user id is set to the real user id.
+If the @option{-p} option is supplied at invocation, the startup behavior is
 the same, but the effective user id is not reset.
 
 @node Interactive Shells
@@ -5102,7 +6284,7 @@ the same, but the effective user id is not reset.
 
 An interactive shell
 is one started without non-option arguments, unless @option{-s} is
-specified, without specifiying the @option{-c} option, and
+specified, without specifying the @option{-c} option, and
 whose input and error output are both
 connected to terminals (as determined by @code{isatty(3)}),
 or one started with the @option{-i} option.
@@ -5179,7 +6361,7 @@ Command history (@pxref{Bash History Facilities})
 and history expansion (@pxref{History Interaction})
 are enabled by default.
 Bash will save the command history to the file named by @env{$HISTFILE}
-when an interactive shell exits.
+when a shell with history enabled exits.
 
 @item
 Alias expansion (@pxref{Aliases}) is performed by default.
@@ -5195,7 +6377,7 @@ In the absence of any traps, @code{SIGINT} is caught and handled
 
 @item
 An interactive login shell sends a @code{SIGHUP} to all jobs on exit
-if the @code{hupoxexit} shell option has been enabled (@pxref{Signals}).
+if the @code{huponexit} shell option has been enabled (@pxref{Signals}).
 
 @item
 The @option{-n} invocation option is ignored, and @samp{set -n} has
@@ -5234,7 +6416,7 @@ Parser syntax errors will not cause the shell to exit.
 @item
 Simple spelling correction for directory arguments to the @code{cd}
 builtin is enabled by default (see the description of the @code{cdspell}
-option to the @code{shopt} builtin in @ref{Bash Builtins}).
+option to the @code{shopt} builtin in @ref{The Shopt Builtin}).
 
 @item
 The shell will check the value of the @env{TMOUT} variable and exit
@@ -5259,6 +6441,10 @@ If the @var{file} argument to one of the primaries is one of
 @file{/dev/stdin}, @file{/dev/stdout}, or @file{/dev/stderr}, file
 descriptor 0, 1, or 2, respectively, is checked.
 
+When used with @code{[[}, the @samp{<} and @samp{>} operators sort
+lexicographically using the current locale.
+The @code{test} command uses ASCII ordering.
+
 Unless otherwise specified, primaries that operate on files follow symbolic
 links and operate on the target of the link, rather than the link itself.
 
@@ -5311,20 +6497,24 @@ True if @var{file} exists and is writable.
 @item -x @var{file}
 True if @var{file} exists and is executable.
 
-@item -O @var{file}
-True if @var{file} exists and is owned by the effective user id.
-
 @item -G @var{file}
 True if @var{file} exists and is owned by the effective group id.
 
 @item -L @var{file}
 True if @var{file} exists and is a symbolic link.
 
+@item -N @var{file}
+True if @var{file} exists and has been modified since it was last read.
+
+@item -O @var{file}
+True if @var{file} exists and is owned by the effective user id.
+
 @item -S @var{file}
 True if @var{file} exists and is a socket.
 
-@item -N @var{file}
-True if @var{file} exists and has been modified since it was last read.
+@item @var{file1} -ef @var{file2}
+True if @var{file1} and @var{file2} refer to the same device and
+inode numbers.
 
 @item @var{file1} -nt @var{file2}
 True if @var{file1} is newer (according to modification date)
@@ -5334,15 +6524,17 @@ than @var{file2}, or if @var{file1} exists and @var{file2} does not.
 True if @var{file1} is older than @var{file2},
 or if @var{file2} exists and @var{file1} does not.
 
-@item @var{file1} -ef @var{file2}
-True if @var{file1} and @var{file2} refer to the same device and
-inode numbers.
-
 @item -o @var{optname}
-True if shell option @var{optname} is enabled.
+True if the shell option @var{optname} is enabled.
 The list of options appears in the description of the @option{-o}
 option to the @code{set} builtin (@pxref{The Set Builtin}).
 
+@item -v @var{varname}
+True if the shell variable @var{varname} is set (has been assigned a value).
+
+@item -R @var{varname}
+True if the shell variable @var{varname} is set and is a name reference.
+
 @item -z @var{string}
 True if the length of @var{string} is zero.
 
@@ -5351,19 +6543,21 @@ True if the length of @var{string} is zero.
 True if the length of @var{string} is non-zero.
 
 @item @var{string1} == @var{string2}
+@itemx @var{string1} = @var{string2}
 True if the strings are equal.
-@samp{=} may be used in place of @samp{==} for strict @sc{posix} compliance.
+When used with the @code{[[} command, this performs pattern matching as
+described above (@pxref{Conditional Constructs}).
+
+@samp{=} should be used with the @code{test} command for @sc{posix} conformance.
 
 @item @var{string1} != @var{string2}
 True if the strings are not equal.
 
 @item @var{string1} < @var{string2}
-True if @var{string1} sorts before @var{string2} lexicographically
-in the current locale.
+True if @var{string1} sorts before @var{string2} lexicographically.
 
 @item @var{string1} > @var{string2}
-True if @var{string1} sorts after @var{string2} lexicographically
-in the current locale.
+True if @var{string1} sorts after @var{string2} lexicographically.
 
 @item @var{arg1} OP @var{arg2}
 @code{OP} is one of 
@@ -5373,7 +6567,6 @@ is equal to, not equal to, less than, less than or equal to,
 greater than, or greater than or equal to @var{arg2},
 respectively.  @var{Arg1} and @var{arg2}
 may be positive or negative integers.
-
 @end table
 
 @node Shell Arithmetic
@@ -5463,16 +6656,17 @@ The value of a variable is evaluated as an arithmetic expression
 when it is referenced, or when a variable which has been given the  
 @var{integer} attribute using @samp{declare -i} is assigned a value.
 A null value evaluates to 0.
-A shell variable need not have its integer attribute turned on
+A shell variable need not have its @var{integer} attribute turned on
 to be used in an expression.
 
 Constants with a leading 0 are interpreted as octal numbers.
 A leading @samp{0x} or @samp{0X} denotes hexadecimal.  Otherwise,
-numbers take the form [@var{base}@code{#}]@var{n}, where @var{base}
+numbers take the form [@var{base}@code{#}]@var{n}, where the optional @var{base}
 is a decimal number between 2 and 64 representing the arithmetic
-base, and @var{n} is a number in that base.  If @var{base}@code{#} is
-omitted, then base 10 is used.
-The digits greater than 9 are represented by the lowercase letters,
+base, and @var{n} is a number in that base.
+If @var{base}@code{#} is omitted, then base 10 is used.
+When specifying @var{n},
+he digits greater than 9 are represented by the lowercase letters,
 the uppercase letters, @samp{@@}, and @samp{_}, in that order.
 If @var{base} is less than or equal to 36, lowercase and uppercase
 letters may be used interchangeably to represent numbers between 10
@@ -5504,8 +6698,9 @@ aliases, but a word that is identical to an alias being expanded
 is not expanded a second time.
 This means that one may alias @code{ls} to @code{"ls -F"},
 for instance, and Bash does not try to recursively expand the
-replacement text. If the last character of the alias value is a
-space or tab character, then the next command word following the
+replacement text.
+If the last character of the alias value is a
+@var{blank}, then the next command word following the
 alias is also checked for alias expansion.
 
 Aliases are created and listed with the @code{alias}
@@ -5518,7 +6713,7 @@ If arguments are needed, a shell function should be used
 
 Aliases are not expanded when the shell is not interactive,
 unless the @code{expand_aliases} shell option is set using
-@code{shopt} (@pxref{Bash Builtins}).
+@code{shopt} (@pxref{The Shopt Builtin}).
 
 The rules concerning the definition and use of aliases are
 somewhat confusing.  Bash
@@ -5545,22 +6740,27 @@ For almost every purpose, shell functions are preferred over aliases.
 @section Arrays
 @cindex arrays
 
-Bash provides one-dimensional array variables.  Any variable may be used as
-an array; the @code{declare} builtin will explicitly declare an array.
+Bash provides one-dimensional indexed and associative array variables.
+Any variable may be used as an indexed array;
+the @code{declare} 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 zero-based.
+be indexed or assigned contiguously.
+Indexed arrays are referenced using integers (including arithmetic
+expressions (@pxref{Shell Arithmetic})) and are zero-based;
+associative arrays use arbitrary strings.
+Unless otherwise noted, indexed array indices must be non-negative integers.
 
-An array is created automatically if any variable is assigned to using
-the syntax
+An indexed array is created automatically if any variable is assigned to
+using the syntax
 @example
-name[@var{subscript}]=@var{value}
+@var{name}[@var{subscript}]=@var{value}
 @end example
 
 @noindent
 The @var{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
+is treated as an arithmetic expression that must evaluate to a number.
+To explicitly declare an array, use
 @example
 declare -a @var{name}
 @end example
@@ -5570,64 +6770,100 @@ The syntax
 declare -a @var{name}[@var{subscript}]
 @end example
 @noindent
-is also accepted; the @var{subscript} is ignored.  Attributes may be
+is also accepted; the @var{subscript} is ignored.
+
+@noindent
+Associative arrays are created using
+@example
+declare -A @var{name}.
+@end example
+
+Attributes may be
 specified for an array variable using the @code{declare} and
 @code{readonly} builtins.  Each attribute applies to all members of
 an array.
 
 Arrays are assigned to using compound assignments of the form
 @example
-name=(value@var{1} @dots{} value@var{n})
+@var{name}=(@var{value1} @var{value2} @dots{} )
 @end example
 @noindent
 where each
-@var{value} is of the form @code{[[@var{subscript}]=]}@var{string}.  If
+@var{value} is of the form @code{[@var{subscript}]=}@var{string}.
+Indexed array assignments do not require anything but @var{string}.
+When assigning to indexed arrays, if
 the optional subscript is 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.
+
+When assigning to an associative array, the subscript is required.
+
 This syntax is also accepted by the @code{declare}
 builtin.  Individual array elements may be assigned to using the
-@code{name[}@var{subscript}@code{]=}@var{value} syntax introduced above.
+@code{@var{name}[@var{subscript}]=@var{value}} syntax introduced above.
+
+When assigning to an indexed array, if @var{name}
+is subscripted by a negative number, that number is
+interpreted as relative to one greater than the maximum index of
+@var{name}, so negative indices count back from the end of the
+array, and an index of -1 references the last element.
 
 Any element of an array may be referenced using
-@code{$@{name[}@var{subscript}@code{]@}}.
+@code{$@{@var{name}[@var{subscript}]@}}.
 The braces are required to avoid
 conflicts with the shell's filename expansion operators.  If the
 @var{subscript} is @samp{@@} or @samp{*}, the word expands to all members
 of the array @var{name}.  These subscripts differ only when the word
 appears within double quotes.
 If the word is double-quoted,
-@code{$@{name[*]@}} expands to a single word with
+@code{$@{@var{name}[*]@}} expands to a single word with
 the value of each array member separated by the first character of the
-@env{IFS} variable, and @code{$@{name[@@]@}} expands each element of
+@env{IFS} variable, and @code{$@{@var{name}[@@]@}} expands each element of
 @var{name} to a separate word.  When there are no array members,
-@code{$@{name[@@]@}} expands to nothing.
+@code{$@{@var{name}[@@]@}} expands to nothing.
 If the double-quoted expansion occurs within a word, the expansion of
 the first parameter is joined with the beginning part of the original
 word, and the expansion of the last parameter is joined with the last
 part of the original word.
 This is analogous to the
 expansion of the special parameters @samp{@@} and @samp{*}. 
-@code{$@{#name[}@var{subscript}@code{]@}} expands to the length of
-@code{$@{name[}@var{subscript}@code{]@}}.
+@code{$@{#@var{name}[@var{subscript}]@}} expands to the length of
+@code{$@{@var{name}[@var{subscript}]@}}.
 If @var{subscript} is @samp{@@} or
 @samp{*}, the expansion is the number of elements in the array. 
 Referencing an array variable without a subscript is equivalent to
-referencing element zero. 
+referencing with a subscript of 0. 
+If the @var{subscript}
+used to reference an element of an indexed array
+evaluates to a number less than zero, it is 
+interpreted as relative to one greater than the maximum index of the array,
+so negative indices count back from the end of the array,
+and an index of -1 refers to the last element.
+
+An array variable is considered set if a subscript has been assigned a
+value.  The null string is a valid value.
+
+It is possible to obtain the keys (indices) of an array as well as the values.
+$@{!@var{name}[@@]@} and $@{!@var{name}[*]@} expand to the indices
+assigned in array variable @var{name}.
+The treatment when in double quotes is similar to the expansion of the
+special parameters @samp{@@} and @samp{*} within double quotes.
 
 The @code{unset} builtin is used to destroy arrays.
-@code{unset} @var{name}[@var{subscript}]
+@code{unset @var{name}[@var{subscript}]}
 destroys the array element at index @var{subscript}.
+Negative subscripts to indexed arrays are interpreted as described above.
 Care must be taken to avoid unwanted side effects caused by filename
-generation.
-@code{unset} @var{name}, where @var{name} is an array, removes the
-entire array. A subscript of @samp{*} or @samp{@@} also removes the
+expansion.
+@code{unset @var{name}}, where @var{name} is an array, removes the
+entire array.  A subscript of @samp{*} or @samp{@@} also removes the
 entire array.
 
 The @code{declare}, @code{local}, and @code{readonly}
-builtins each accept a @option{-a}
-option to specify an array.  The @code{read}
-builtin accepts a @option{-a}
+builtins each accept a @option{-a} option to specify an indexed
+array and a @option{-A} option to specify an associative array.
+If both options are supplied, @option{-A} takes precedence.
+The @code{read} builtin accepts a @option{-a}
 option to assign a list of words read from the standard input
 to an array, and can read values from the standard input into
 individual array elements.  The @code{set} and @code{declare}
@@ -5661,37 +6897,39 @@ as the value of the @env{DIRSTACK} shell variable.
 @item dirs
 @btindex dirs
 @example
-dirs [+@var{N} | -@var{N}] [-clpv]
+dirs [-clpv] [+@var{N} | -@var{N}]
 @end example
+
 Display the list of currently remembered directories.  Directories
 are added to the list with the @code{pushd} command; the
 @code{popd} command removes directories from the list.
+
 @table @code
-@item +@var{N}
-Displays the @var{N}th directory (counting from the left of the
-list printed by @code{dirs} when invoked without options), starting
-with zero.
-@item -@var{N}
-Displays the @var{N}th directory (counting from the right of the
-list printed by @code{dirs} when invoked without options), starting
-with zero.
 @item -c
 Clears the directory stack by deleting all of the elements.
 @item -l
-Produces a longer listing; the default listing format uses a 
-tilde to denote the home directory.
+Produces a listing using full pathnames;
+the default listing format uses a tilde to denote the home directory.
 @item -p
 Causes @code{dirs} to print the directory stack with one entry per
 line.
 @item -v
 Causes @code{dirs} to print the directory stack with one entry per
 line, prefixing each entry with its index in the stack.
+@item +@var{N}
+Displays the @var{N}th directory (counting from the left of the
+list printed by @code{dirs} when invoked without options), starting
+with zero.
+@item -@var{N}
+Displays the @var{N}th directory (counting from the right of the
+list printed by @code{dirs} when invoked without options), starting
+with zero.
 @end table
 
 @item popd
 @btindex popd
 @example
-popd [+@var{N} | -@var{N}] [-n]
+popd [-n] [+@var{N} | -@var{N}]
 @end example
 
 Remove the top entry from the directory stack, and @code{cd}
@@ -5700,23 +6938,24 @@ When no arguments are given, @code{popd}
 removes the top directory from the stack and
 performs a @code{cd} to the new top directory.  The
 elements are numbered from 0 starting at the first directory listed with
-@code{dirs}; i.e., @code{popd} is equivalent to @code{popd +0}.
+@code{dirs}; that is, @code{popd} is equivalent to @code{popd +0}.
+
 @table @code
+@item -n
+Suppresses the normal change of directory when removing directories
+from the stack, so that only the stack is manipulated.
 @item +@var{N}
 Removes the @var{N}th directory (counting from the left of the
 list printed by @code{dirs}), starting with zero.
 @item -@var{N}
 Removes the @var{N}th directory (counting from the right of the
 list printed by @code{dirs}), starting with zero.
-@item -n
-Suppresses the normal change of directory when removing directories
-from the stack, so that only the stack is manipulated.
 @end table
 
 @btindex pushd
 @item pushd
 @example
-pushd [@var{dir} | @var{+N} | @var{-N}] [-n]
+pushd [-n] [@var{+N} | @var{-N} | @var{dir}]
 @end example
 
 Save the current directory on the top of the directory stack
@@ -5724,6 +6963,9 @@ and then @code{cd} to @var{dir}.
 With no arguments, @code{pushd} exchanges the top two directories.
 
 @table @code
+@item -n
+Suppresses the normal change of directory when adding directories
+to the stack, so that only the stack is manipulated.
 @item +@var{N}
 Brings the @var{N}th directory (counting from the left of the
 list printed by @code{dirs}, starting with zero) to the top of
@@ -5732,18 +6974,14 @@ the list by rotating the stack.
 Brings the @var{N}th directory (counting from the right of the
 list printed by @code{dirs}, starting with zero) to the top of
 the list by rotating the stack.
-@item -n
-Suppresses the normal change of directory when adding directories
-to the stack, so that only the stack is manipulated.
 @item @var{dir}
-Makes the current working directory be the top of the stack, and then
-executes the equivalent of `@code{cd} @var{dir}'.
-@code{cd}s to @var{dir}.
+Makes the current working directory be the top of the stack, making
+it the new current directory as if it had been supplied as an argument
+to the @code{cd} builtin.
 @end table
-
 @end table
 
-@node Printing a Prompt
+@node Controlling the Prompt
 @section Controlling the Prompt
 @cindex prompting
 
@@ -5753,7 +6991,7 @@ has a non-null value, then the
 value is executed just as if it had been typed on the command line.
 
 In addition, the following table describes the special characters which
-can appear in the prompt variables:
+can appear in the prompt variables @env{PS1} to @env{PS4}:
 
 @table @code
 @item \a
@@ -5796,7 +7034,8 @@ The version of Bash (e.g., 2.00)
 @item \V
 The release of Bash, version + patchlevel (e.g., 2.00.0)
 @item \w
-The current working directory, with @env{$HOME} abbreviated with a tilde.
+The current working directory, with @env{$HOME} abbreviated with a tilde
+(uses the @env{$PROMPT_DIRTRIM} variable).
 @item \W
 The basename of @env{$PWD}, with @env{$HOME} abbreviated with a tilde.
 @item \!
@@ -5888,7 +7127,7 @@ the shell spawned to execute the script.
 
 Starting Bash with the @option{--posix} command-line option or executing
 @samp{set -o posix} while Bash is running will cause Bash to conform more
-closely to the @sc{posix} 1003.2 standard by changing the behavior to
+closely to the @sc{posix} standard by changing the behavior to
 match that specified by @sc{posix} in areas where the Bash default differs.
 
 When invoked as @code{sh}, Bash enters @sc{posix} mode after reading the
@@ -5921,13 +7160,13 @@ Reserved words appearing in a context where reserved words are recognized
 do not undergo alias expansion.
 
 @item
-The @sc{posix} 1003.2 @env{PS1} and @env{PS2} expansions of @samp{!} to
+The @sc{posix} @env{PS1} and @env{PS2} expansions of @samp{!} to
 the history number and @samp{!!} to @samp{!} are enabled,
 and parameter expansion is performed on the values of @env{PS1} and
 @env{PS2} regardless of the setting of the @code{promptvars} option.
 
 @item
-The @sc{posix} 1003.2 startup files are executed (@env{$ENV}) rather than
+The @sc{posix} startup files are executed (@env{$ENV}) rather than
 the normal Bash files.
 
 @item
@@ -5935,6 +7174,12 @@ Tilde expansion is only performed on assignments preceding a command
 name, rather than on all assignment statements on the line.
 
 @item
+The @code{command} builtin does not prevent builtins that take assignment
+statements as arguments from expanding them as assignment statements;
+when not in @sc{posix} mode, assignment builtins lose their assignment
+statement expansion properties when preceded by @code{command}.
+
+@item
 The default history file is @file{~/.sh_history} (this is the
 default value of @env{$HISTFILE}).
 
@@ -5955,6 +7200,11 @@ Non-interactive shells exit if a syntax error in an arithmetic expansion
 results in an invalid expression.
 
 @item
+Non-interactive shells exit if there is a syntax error in a script read
+with the @code{.} or @code{source} builtins, or in a string processed by
+the @code{eval} builtin.
+
+@item
 Redirection operators do not perform filename expansion on the word
 in the redirection unless the shell is interactive.
 
@@ -5969,25 +7219,38 @@ may not start with a digit.  Declaring a function with an invalid name
 causes a fatal syntax error in non-interactive shells.
 
 @item
-@sc{posix} 1003.2 special builtins are found before shell functions
+Function names may not be the same as one of the @sc{posix} special
+builtins.
+
+@item
+@sc{posix} special builtins are found before shell functions
 during command lookup.
 
 @item
-If a @sc{posix} 1003.2 special builtin returns an error status, a
+The @code{time} reserved word may be used by itself as a command.  When
+used in this way, it displays timing statistics for the shell and its
+completed children.  The @env{TIMEFORMAT} variable controls the format
+of the timing information.
+
+@item
+When parsing and expanding a $@{@dots{}@} expansion that appears within
+double quotes, single quotes are no longer special and cannot be used to
+quote a closing brace or other special character, unless the operator is
+one of those defined to perform pattern removal.  In this case, they do
+not have to appear as matched pairs.
+
+@item
+The parser does not recognize @code{time} as a reserved word if the next
+token begins with a @samp{-}.
+
+@item
+If a @sc{posix} special builtin returns an error status, a
 non-interactive shell exits.  The fatal errors are those listed in
-the POSIX.2 standard, and include things like passing incorrect options,
+the @sc{posix} standard, and include things like passing incorrect options,
 redirection errors, variable assignment errors for assignments preceding
 the command name, and so on.
 
 @item
-If @env{CDPATH} is set, the @code{cd} builtin will not implicitly
-append the current directory to it.  This means that @code{cd} will
-fail if no valid directory name can be constructed from
-any of the entries in @env{$CDPATH}, even if the a directory with
-the same name as the name given as an argument to @code{cd} exists
-in the current directory.
-
-@item
 A non-interactive shell exits with an error status if a variable
 assignment error occurs when no command name follows the assignment
 statements.
@@ -5995,6 +7258,11 @@ A variable assignment error occurs, for example, when trying to assign
 a value to a readonly variable.
 
 @item
+A non-interactive shell exits with an error status if a variable
+assignment error occurs in an assignment statement preceding a special
+builtin, but not with any other simple command.
+
+@item
 A non-interactive shell exits with an error status if the iteration
 variable in a @code{for} statement or the selection variable in a
 @code{select} statement is a readonly variable.
@@ -6003,7 +7271,11 @@ variable in a @code{for} statement or the selection variable in a
 Process substitution is not available.
 
 @item
-Assignment statements preceding @sc{posix} 1003.2 special builtins
+While variable indirection is available, it may not be applied to the
+@samp{#} and @samp{?} special parameters.
+
+@item
+Assignment statements preceding @sc{posix} special builtins
 persist in the shell environment after the builtin completes.
 
 @item
@@ -6013,7 +7285,7 @@ special builtin command had been executed.
 
 @item
 The @code{export} and @code{readonly} builtin commands display their
-output in the format required by @sc{posix} 1003.2.
+output in the format required by @sc{posix}.
 
 @item
 The @code{trap} builtin displays signal names without the leading
@@ -6060,10 +7332,6 @@ does not refer to an existing directory, @code{cd} will fail instead of
 falling back to @var{physical} mode.
 
 @item
-When the @code{pwd} builtin is supplied the @option{-P} option, it resets
-@code{$PWD} to a pathname containing no symlinks.
-
-@item
 The @code{pwd} builtin verifies that the value it prints is the same as the
 current directory, even if it is not asked to check the file system with the
 @option{-P} option.
@@ -6082,7 +7350,7 @@ file if it is the only so-named file found in @code{$PATH}.
 
 @item
 The @code{vi} editing mode will invoke the @code{vi} editor directly when
-the @samp{v} command is run, instead of checking @code{$FCEDIT} and
+the @samp{v} command is run, instead of checking @code{$VISUAL} and
 @code{$EDITOR}.
 
 @item
@@ -6090,9 +7358,24 @@ When the @code{xpg_echo} option is enabled, Bash does not attempt to interpret
 any arguments to @code{echo} as options.  Each argument is displayed, after
 escape characters are converted.
 
+@item
+The @code{ulimit} builtin uses a block size of 512 bytes for the @option{-c}
+and @option{-f} options.
+
+@item
+The arrival of @code{SIGCHLD}  when a trap is set on @code{SIGCHLD} does
+not interrupt the @code{wait} builtin and cause it to return immediately.
+The trap command is run once for each child that exits.
+
+@item
+The @code{read} builtin may be interrupted by a signal for which a trap
+has been set.
+If Bash receives a trapped signal while executing @code{read}, the trap
+handler executes and @code{read} returns an exit status greater than 128.
+
 @end enumerate
 
-There is other @sc{posix} 1003.2 behavior that Bash does not implement by
+There is other @sc{posix} behavior that Bash does not implement by
 default even when in @sc{posix} mode.
 Specifically:
 
@@ -6139,7 +7422,7 @@ refers to the ability to selectively stop (suspend)
 the execution of processes and continue (resume)
 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 Bash.
+by the operating system kernel's terminal driver and Bash.
 
 The shell associates a @var{job} with each pipeline.  It keeps a
 table of currently executing jobs, which may be listed with the
@@ -6164,11 +7447,13 @@ process group @sc{id} is equal to the current terminal process group
 These processes are said to be in the foreground.  Background
 processes are those whose process group @sc{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 terminal are sent a @code{SIGTTIN}
-(@code{SIGTTOU}) signal by the terminal driver, which, unless
-caught, suspends the process. 
+signals.  Only foreground processes are allowed to read from or, if
+the user so specifies with @code{stty tostop}, write to the terminal.
+Background processes which attempt to
+read from (write to when @code{stty tostop} is in effect) the
+terminal are sent a @code{SIGTTIN} (@code{SIGTTOU})
+signal by the kernel's terminal driver,
+which, unless caught, suspends the process. 
 
 If the operating system on which Bash is running supports
 job control, Bash contains facilities to use it.  Typing the
@@ -6185,7 +7470,7 @@ takes effect immediately, and has the additional side effect of
 causing pending output and typeahead to be discarded. 
 
 There are a number of ways to refer to a job in the shell.  The
-character @samp{%} introduces a job name.
+character @samp{%} introduces a job specification (@var{jobspec}).
 
 Job number @code{n} may be referred to as @samp{%n}.
 The symbols @samp{%%} and  @samp{%+} refer to the shell's notion of the
@@ -6193,15 +7478,17 @@ current job, which is the last job stopped while it was in the foreground
 or started in the background.
 A single @samp{%} (with no accompanying job specification) also refers
 to the current job.
-The previous job may be referenced using @samp{%-}.  In output
-pertaining to jobs (e.g., the output of the @code{jobs} command),
-the current job is always flagged with a @samp{+}, and the
+The previous job may be referenced using @samp{%-}.
+If there is only a single job, @samp{%+} and @samp{%-} can both be used
+to refer to that job.
+In output pertaining to jobs (e.g., the output of the @code{jobs}
+command), the current job is always flagged with a @samp{+}, and the
 previous job with a @samp{-}. 
 
 A job may also be referred to
 using a prefix of the name used to start it, or using a substring
 that appears in its command line.  For example, @samp{%ce} refers
-to a stopped @code{ce} job. Using @samp{%?ce}, on the
+to a stopped @code{ce} job.  Using @samp{%?ce}, on the
 other hand, refers to any job containing the string @samp{ce} in
 its command line.  If the prefix or substring matches more than one job,
 Bash reports an error.
@@ -6220,11 +7507,13 @@ Bash reports such changes immediately (@pxref{The Set Builtin}).
 Any trap on @code{SIGCHLD} is executed for each child process
 that exits.
 
-If an attempt to exit Bash is made while jobs are stopped, the
-shell prints a message warning that there are stopped jobs.
+If an attempt to exit Bash is made while jobs are stopped, (or running, if
+the @code{checkjobs} option is enabled -- see @ref{The Shopt Builtin}), the
+shell prints a warning message, and if the @code{checkjobs} option is
+enabled, lists the jobs and their statuses.
 The @code{jobs} command may then be used to inspect their status.
 If a second attempt to exit is made without an intervening command,
-Bash does not print another warning, and the stopped jobs are terminated.
+Bash does not print another warning, and any stopped jobs are terminated.
 
 @node Job Control Builtins
 @section Job Control Builtins
@@ -6236,6 +7525,7 @@ Bash does not print another warning, and the stopped jobs are terminated.
 @example
 bg [@var{jobspec} @dots{}]
 @end example
+
 Resume each suspended job @var{jobspec} in the background, as if it
 had been started with @samp{&}.
 If @var{jobspec} is not supplied, the current job is used.
@@ -6249,6 +7539,7 @@ that was started without job control.
 @example
 fg [@var{jobspec}]
 @end example
+
 Resume the job @var{jobspec} in the foreground and make it the current job.
 If @var{jobspec} is not supplied, the current job is used.
 The return status is that of the command placed into the foreground,
@@ -6278,10 +7569,10 @@ the user was last notified of their status.
 List only the process @sc{id} of the job's process group leader.
 
 @item -r
-Restrict output to running jobs.
+Display only running jobs.
 
 @item -s
-Restrict output to stopped jobs.
+Display only stopped jobs.
 @end table
 
 If @var{jobspec} is given,
@@ -6300,6 +7591,7 @@ passing it @var{argument}s, returning its exit status.
 kill [-s @var{sigspec}] [-n @var{signum}] [-@var{sigspec}] @var{jobspec} or @var{pid}
 kill -l [@var{exit_status}]
 @end example
+
 Send a signal specified by @var{sigspec} or @var{signum} to the process
 named by job specification @var{jobspec} or process @sc{id} @var{pid}.
 @var{sigspec} is either a case-insensitive signal name such as
@@ -6318,14 +7610,17 @@ or non-zero if an error occurs or an invalid option is encountered.
 @item wait
 @btindex wait
 @example
-wait [@var{jobspec} or @var{pid} ...]
+wait [-n] [@var{jobspec} or @var{pid} @dots{}]
 @end example
+
 Wait until the child process specified by each process @sc{id} @var{pid}
 or job specification @var{jobspec} exits and return the exit status of the
 last command waited for.
 If a job spec is given, all processes in the job are waited for.
 If no arguments are given, all currently active child processes are
 waited for, and the return status is zero.
+If the @option{-n} option is supplied, @code{wait} waits for any job to
+terminate and returns its exit status.
 If neither @var{jobspec} nor @var{pid} specifies an active child process
 of the shell, the return status is 127.
 
@@ -6334,13 +7629,14 @@ of the shell, the return status is 127.
 @example
 disown [-ar] [-h] [@var{jobspec} @dots{}]
 @end example
-Without options, each @var{jobspec} is removed from the table of
+
+Without options, remove each @var{jobspec} from the table of
 active jobs.
 If the @option{-h} option is given, the job is not removed from the table,
 but is marked so that @code{SIGHUP} is not sent to the job if the shell
 receives a @code{SIGHUP}.
-If @var{jobspec} is not present, and neither the @option{-a} nor @option{-r}
-option is supplied, the current job is used.
+If @var{jobspec} is not present, and neither the @option{-a} nor the
+@option{-r} option is supplied, the current job is used.
 If no @var{jobspec} is supplied, the @option{-a} option means to remove or
 mark all jobs; the @option{-r} option without a @var{jobspec}
 argument restricts operation to running jobs.
@@ -6350,10 +7646,11 @@ argument restricts operation to running jobs.
 @example
 suspend [-f]
 @end example
-Suspend the execution of this shell until it receives a
-@code{SIGCONT} signal.  The @option{-f} option means to suspend
-even if the shell is a login shell.
 
+Suspend the execution of this shell until it receives a
+@code{SIGCONT} signal.
+A login shell cannot be suspended; the @option{-f}
+option can be used to override this and force the suspension.
 @end table
 
 When job control is not active, the @code{kill} and @code{wait}
@@ -6488,9 +7785,9 @@ to do them, and mail diffs or instructions to
 @email{bash-maintainers@@gnu.org} so they can be
 considered for the next release.
 
-The file @file{configure.in} is used to create @code{configure}
+The file @file{configure.ac} is used to create @code{configure}
 by a program called Autoconf.  You only need
-@file{configure.in} if you want to change it or regenerate
+@file{configure.ac} if you want to change it or regenerate
 @code{configure} using a newer version of Autoconf.  If
 you do this, make sure you are using Autoconf version 2.50 or
 newer.
@@ -6721,7 +8018,8 @@ The @samp{minimal-config} option can be used to disable all of
 the following options, but it is processed first, so individual
 options may be enabled using @samp{enable-@var{feature}}. 
 
-All of the following options except for @samp{disabled-builtins} and
+All of the following options except for @samp{disabled-builtins},
+@samp{directpand-default}, and
 @samp{xpg-echo-default} are
 enabled by default, unless the operating system does not provide the
 necessary support.
@@ -6749,6 +8047,14 @@ Include @code{csh}-like brace expansion
 ( @code{b@{a,b@}c} @expansion{} @code{bac bbc} ).
 See @ref{Brace Expansion}, for a complete description.
 
+@item --enable-casemod-attributes
+Include support for case-modifying attributes in the @code{declare} builtin
+and assignment statements.  Variables with the @var{uppercase} attribute,
+for example, will have their values converted to uppercase upon assignment.
+
+@item --enable-casemod-expansion
+Include support for case-modifying word expansions.
+
 @item --enable-command-timing
 Include support for recognizing @code{time} as a reserved word and for
 displaying timing statistics for the pipeline following @code{time}
@@ -6760,13 +8066,22 @@ Include support for the @code{[[} conditional command.
 (@pxref{Conditional Constructs}).
 
 @item --enable-cond-regexp
-Include support for matching POSIX regular expressions using the
+Include support for matching @sc{posix} regular expressions using the
 @samp{=~} binary operator in the @code{[[} conditional command.
 (@pxref{Conditional Constructs}).
 
+@item --enable-coprocesses
+Include support for coprocesses and the @code{coproc} reserved word
+(@pxref{Pipelines}).
+
 @item --enable-debugger
 Include support for the bash debugger (distributed separately).
 
+@item --enable-direxpand-default
+Cause the @code{direxpand} shell option (@pxref{The Shopt Builtin})
+to be enabled by default when the shell starts.
+It is normally disabled by default.
+
 @item --enable-directory-stack
 Include support for a @code{csh}-like directory stack and the
 @code{pushd}, @code{popd}, and @code{dirs} builtins
@@ -6786,6 +8101,16 @@ Include support for the @code{((@dots{}))} command
 Include support for the extended pattern matching features described
 above under @ref{Pattern Matching}.
 
+@item --enable-extended-glob-default
+Set the default value of the @var{extglob} shell option described
+above under @ref{The Shopt Builtin} to be enabled.
+
+@item --enable-glob-asciirange-default
+Set the default value of the @var{globasciiranges} shell option described
+above under @ref{The Shopt Builtin} to be enabled.
+This controls the behavior of character ranges when used in pattern matching
+bracket expressions.
+
 @item --enable-help-builtin
 Include the @code{help} builtin, which displays help on shell builtins and
 variables (@pxref{Bash Builtins}).
@@ -6820,7 +8145,7 @@ If Readline is not enabled, this option has no effect.
 @item --enable-prompt-string-decoding
 Turn on the interpretation of a number of backslash-escaped characters
 in the @env{$PS1}, @env{$PS2}, @env{$PS3}, and @env{$PS4} prompt
-strings.  See @ref{Printing a Prompt}, for a complete list of prompt
+strings.  See @ref{Controlling the Prompt}, for a complete list of prompt
 string escape sequences.
 
 @item --enable-readline
@@ -6833,8 +8158,8 @@ when called as @code{rbash}, enters a restricted mode.  See
 @ref{The Restricted Shell}, for a description of restricted mode.
 
 @item --enable-select
-Include the @code{select} builtin, which allows the generation of simple
-menus (@pxref{Conditional Constructs}).
+Include the @code{select} compound command, which allows the generation of
+simple menus (@pxref{Conditional Constructs}).
 
 @item --enable-separate-helpfiles
 Use external files for the documentation displayed by the @code{help} builtin
@@ -6860,7 +8185,6 @@ which makes the Bash @code{echo} behave more like the version specified in
 the Single Unix Specification, version 3.
 @xref{Bash Builtins}, for a description of the escape sequences that
 @code{echo} recognizes.
-
 @end table
 
 The file @file{config-top.h} contains C Preprocessor
@@ -6879,7 +8203,7 @@ But first, you should
 make sure that it really is a bug, and that it appears in the latest
 version of Bash.
 The latest version of Bash is always available for FTP from
-@uref{ftp://ftp.gnu.org/pub/bash/}.
+@uref{ftp://ftp.gnu.org/pub/gnu/bash/}.
 
 Once you have determined that a bug actually exists, use the
 @code{bashbug} command to submit a bug report.
@@ -6908,14 +8232,14 @@ to reproduce it.
 the template it provides for filing a bug report.
 
 Please send all reports concerning this manual to
-@email{chet@@po.CWRU.Edu}.
+@email{bug-bash@@gnu.org}.
 
 @node Major Differences From The Bourne Shell
 @appendix Major Differences From The Bourne Shell
 
 Bash implements essentially the same grammar, parameter and
 variable expansion, redirection, and quoting as the Bourne Shell. 
-Bash uses the @sc{posix} 1003.2 standard as the specification of
+Bash uses the @sc{posix} standard as the specification of
 how these features are to be implemented.  There are some
 differences between the traditional Bourne shell and Bash; this
 section quickly details the differences of significance.  A
@@ -6939,8 +8263,9 @@ the @code{bind} builtin.
 
 @item
 Bash provides a programmable word completion mechanism
-(@pxref{Programmable Completion}), and two builtin commands,
-@code{complete} and @code{compgen}, to manipulate it.
+(@pxref{Programmable Completion}), and builtin commands
+@code{complete}, @code{compgen}, and @code{compopt}, to
+manipulate it.
 
 @item
 Bash has command history (@pxref{Bash History Facilities}) and the
@@ -7044,7 +8369,7 @@ which matches @var{pattern} and replaces it with @var{replacement} in
 the value of @code{var}, is available (@pxref{Shell Parameter Expansion}).
 
 @item
-The expansion @code{$@{!@var{prefix@}*}} expansion, which expands to
+The expansion @code{$@{!@var{prefix}*@}} expansion, which expands to
 the names of all shell variables whose names begin with @var{prefix},
 is available (@pxref{Shell Parameter Expansion}).
 
@@ -7079,7 +8404,12 @@ not all words (@pxref{Word Splitting}).
 This closes a longstanding shell security hole.
 
 @item
-Bash implements the full set of @sc{posix} 1003.2 filename expansion operators,
+The filename expansion bracket expression code uses @samp{!} and @samp{^}
+to negate the set of characters between the brackets.
+The Bourne shell uses only @samp{!}.
+
+@item
+Bash implements the full set of @sc{posix} filename expansion operators,
 including @var{character classes}, @var{equivalence classes}, and
 @var{collating symbols} (@pxref{Filename Expansion}).
 
@@ -7207,7 +8537,7 @@ executed with the @code{.} or @code{source} builtins
 
 @item
 Bash includes the @code{shopt} builtin, for finer control of shell
-optional capabilities (@pxref{Bash Builtins}), and allows these options
+optional capabilities (@pxref{The Shopt Builtin}), and allows these options
 to be set and unset at shell invocation (@pxref{Invoking Bash}).
 
 @item
@@ -7215,7 +8545,7 @@ Bash has much more optional behavior controllable with the @code{set}
 builtin (@pxref{The Set Builtin}).
 
 @item
-The @samp{-x} (@code{xtrace}) option displays commands other than
+The @samp{-x} (@option{xtrace}) option displays commands other than
 simple commands when performing an execution trace
 (@pxref{The Set Builtin}).
 
@@ -7278,7 +8608,7 @@ Bash also makes the directory stack visible as the value of the
 
 @item
 Bash interprets special backslash-escaped characters in the prompt
-strings when interactive (@pxref{Printing a Prompt}).
+strings when interactive (@pxref{Controlling the Prompt}).
 
 @item
 The Bash restricted mode is more useful (@pxref{The Restricted Shell});
@@ -7364,41 +8694,50 @@ with a @samp{-}.
 
 @item
 The SVR4.2 shell exits a script if any builtin fails; Bash exits
-a script only if one of the @sc{posix} 1003.2 special builtins fails, and
-only for certain failures, as enumerated in the @sc{posix} 1003.2 standard.
+a script only if one of the @sc{posix} special builtins fails, and
+only for certain failures, as enumerated in the @sc{posix} standard.
 
 @item 
 The SVR4.2 shell behaves differently when invoked as @code{jsh}
 (it turns on job control).
 @end itemize
 
-@node Copying This Manual
-@appendix Copying This Manual
+@node GNU Free Documentation License
+@appendix GNU Free Documentation License
+
+@include fdl.texi
+
+@node Indexes
+@appendix Indexes
 
 @menu
-* GNU Free Documentation License::      License for copying this manual.
+* Builtin Index::              Index of Bash builtin commands.
+* Reserved Word Index::                Index of Bash reserved words.
+* Variable Index::             Quick reference helps you find the
+                               variable you want.
+* Function Index::             Index of bindable Readline functions.
+* Concept Index::              General index for concepts described in
+                               this manual.
 @end menu
 
-@include fdl.texi
-
 @node Builtin Index
-@unnumbered Index of Shell Builtin Commands
+@appendixsec Index of Shell Builtin Commands
 @printindex bt
 
 @node Reserved Word Index
-@unnumbered Index of Shell Reserved Words
+@appendixsec Index of Shell Reserved Words
 @printindex rw
 
 @node Variable Index
-@unnumbered Parameter and Variable Index
+@appendixsec Parameter and Variable Index
 @printindex vr
 
 @node Function Index
-@unnumbered Function Index
+@appendixsec Function Index
 @printindex fn
 
 @node Concept Index
-@unnumbered Concept Index
+@appendixsec Concept Index
 @printindex cp
 
 @bye