summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2009-01-12 13:36:28 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:47:00 +0000
commit3185942a5234e26ab13fa02f9c51d340cec514f8 (patch)
tree2c6fcd01779faef1f91c5d84d63981ca3479137d /doc
parentf1be666c7d78939ad775078d290bec2758fa29a2 (diff)
downloadbash-3185942a5234e26ab13fa02f9c51d340cec514f8.tar.gz
Imported from ../bash-4.0-rc1.tar.gz.
Diffstat (limited to 'doc')
-rw-r--r--doc/FAQ47
-rw-r--r--doc/Makefile.in43
-rw-r--r--doc/bash.1836
-rw-r--r--doc/bashbug.129
-rw-r--r--doc/bashref.info2217
-rw-r--r--doc/bashref.texi1225
-rw-r--r--doc/builtins.114
-rw-r--r--doc/fdl.texi21
-rw-r--r--doc/rbash.12
-rw-r--r--doc/version.texi12
10 files changed, 2932 insertions, 1514 deletions
diff --git a/doc/FAQ b/doc/FAQ
index f2a6f57a..4cebba09 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,4 +1,4 @@
-This is the Bash FAQ, version 3.34, for Bash version 3.2.
+This is the Bash FAQ, version 3.36, for Bash version 3.2.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
@@ -79,6 +79,8 @@ E11) If I resize my xterm while another program is running, why doesn't bash
notice the change?
E12) Why don't negative offsets in substring expansion work like I expect?
E13) Why does filename completion misbehave if a colon appears in the filename?
+E14) Why does quoting the pattern argument to the regular expression matching
+ conditional operator (=~) cause matching to stop working?
Section F: Things to watch out for on certain Unix versions
@@ -908,7 +910,9 @@ D1) Why does bash run a different version of `command' than
On many systems, `which' is actually a csh script that assumes
you're running csh. In tcsh, `which' and its cousin `where'
are builtins. On other Unix systems, `which' is a perl script
-that uses the PATH environment variable.
+that uses the PATH environment variable. Many Linux distributions
+use GNU `which', which is a C program that can understand shell
+aliases.
The csh script version reads the csh startup files from your
home directory and uses those to determine which `command' will
@@ -1425,6 +1429,34 @@ COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
You can also quote the colon with a backslash to achieve the same result
temporarily.
+E14) Why does quoting the pattern argument to the regular expression matching
+ conditional operator (=~) cause regexp matching to stop working?
+
+In versions of bash prior to bash-3.2, the effect of quoting the regular
+expression argument to the [[ command's =~ operator was not specified.
+The practical effect was that double-quoting the pattern argument required
+backslashes to quote special pattern characters, which interfered with the
+backslash processing performed by double-quoted word expansion and was
+inconsistent with how the == shell pattern matching operator treated
+quoted characters.
+
+In bash-3.2, the shell was changed to internally quote characters in single-
+and double-quoted string arguments to the =~ operator, which suppresses the
+special meaning of the characters special to regular expression processing
+(`.', `[', `\', `(', `), `*', `+', `?', `{', `|', `^', and `$') and forces
+them to be matched literally. This is consistent with how the `==' pattern
+matching operator treats quoted portions of its pattern argument.
+
+Since the treatment of quoted string arguments was changed, several issues
+have arisen, chief among them the problem of white space in pattern arguments
+and the differing treatment of quoted strings between bash-3.1 and bash-3.2.
+Both problems may be solved by using a shell variable to hold the pattern.
+Since word splitting is not performed when expanding shell variables in all
+operands of the [[ command, this allows users to quote patterns as they wish
+when assigning the variable, then expand the values to a single string that
+may contain whitespace. The first problem may be solved by using backslashes
+or any other quoting mechanism to escape the white space in the patterns.
+
Section F: Things to watch out for on certain Unix versions
F1) Why can't I use command line editing in my `cmdtool'?
@@ -1742,7 +1774,12 @@ this:
echo .!(.|) *
A solution that works without extended globbing is given in the Unix Shell
-FAQ, posted periodically to comp.unix.shell.
+FAQ, posted periodically to comp.unix.shell. It's a variant of
+
+ echo .[!.]* ..?* *
+
+(The ..?* catches files with names of three or more characters beginning
+with `..')
Section H: Where do I go from here?
@@ -1791,8 +1828,8 @@ it in fine bookstores near you. This edition of the book has been updated
to cover bash-3.0.
The GNU Bash Reference Manual has been published as a printed book by
-Network Theory Ltd (Paperback, ISBN: 0-9541617-7-7, Feb 2003). It covers
-bash-2.0 and is available from most online bookstores (see
+Network Theory Ltd (Paperback, ISBN: 0-9541617-7-7, Nov. 2006). It covers
+bash-3.2 and is available from most online bookstores (see
http://www.network-theory.co.uk/bash/manual/ for details). The publisher
will donate $1 to the Free Software Foundation for each copy sold.
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 270ddfd7..2bbfc3ce 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,20 +1,19 @@
# This Makefile is for the Bash/documentation directory -*- text -*-.
#
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003-2009 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
@@ -35,6 +34,8 @@ VPATH = .:@srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
+
infodir = @infodir@
# set this to a directory name to have the HTML files installed
@@ -143,6 +144,7 @@ BASHREF_FILES = $(srcdir)/bashref.texi $(srcdir)/version.texi
all: ps info dvi text html
nodvi: ps info text html
+everything: all pdf
PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps
DVIFILES = bashref.dvi bashref.ps
@@ -223,9 +225,12 @@ installdirs:
install: info installdirs bash.info
-$(INSTALL_DATA) $(srcdir)/bash.1 $(DESTDIR)$(man1dir)/bash${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
-# uncomment the next line to install the builtins man page
-# -$(INSTALL_DATA) $(srcdir)/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
- -$(INSTALL_DATA) $(srcdir)/bash.info $(DESTDIR)$(infodir)/bash.info
+# uncomment the next lines to install the builtins man page
+# sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
+# -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
+# -$(RM) $${TMPDIR:-/var/tmp}/builtins.1
+ -if test -f bash.info; then d=.; else d=$(srcdir); fi; \
+ $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info
# run install-info if it is present to update the info directory
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \
@@ -236,8 +241,16 @@ install: info installdirs bash.info
$(INSTALL_DATA) $(srcdir)/bashref.html $(DESTDIR)$(htmldir) ; \
fi
+install_builtins: installdirs
+ sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
+ -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
+ -$(RM) $${TMPDIR:-/var/tmp}/builtins.1
+
+install_everything: install install_builtins
+
uninstall:
-$(RM) $(DESTDIR)$(man1dir)/bash${man1ext} $(DESTDIR)$(man1dir)/bashbug${man1ext}
+ -$(RM) $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
$(RM) $(DESTDIR)$(infodir)/bash.info
-if test -n "$(htmldir)" ; then \
$(RM) $(DESTDIR)$(htmldir)/bash.html ; \
diff --git a/doc/bash.1 b/doc/bash.1
index 4d977f9a..016abba6 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -2,16 +2,15 @@
.\" MAN PAGE COMMENTS to
.\"
.\" Chet Ramey
-.\" Information Network Services
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
-.\" Last Change: Thu Sep 28 10:25:59 EDT 2006
+.\" Last Change: Mon Dec 29 16:49:01 EST 2008
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2006 September 28" "GNU Bash-3.2"
+.TH BASH 1 "2008 December 29" "GNU Bash-4.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -51,8 +50,8 @@ bash \- GNU Bourne-Again SHell
[options]
[file]
.SH COPYRIGHT
-.if n Bash is Copyright (C) 1989-2005 by the Free Software Foundation, Inc.
-.if t Bash is Copyright \(co 1989-2005 by the Free Software Foundation, Inc.
+.if n Bash is Copyright (C) 1989-2009 by the Free Software Foundation, Inc.
+.if t Bash is Copyright \(co 1989-2009 by the Free Software Foundation, Inc.
.SH DESCRIPTION
.B Bash
is an \fBsh\fR-compatible command language interpreter that
@@ -410,11 +409,12 @@ whose name is the expanded value.
No other startup files are read.
.PP
.B Bash
-attempts to determine when it is being run by the remote shell
-daemon, usually \fIrshd\fP.
+attempts to determine when it is being run with its standard input
+connected to a a network connection, as if by the remote shell
+daemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP.
If
.B bash
-determines it is being run by \fIrshd\fP, it reads and executes
+determines it is being run in this fashion, it reads and executes
commands from \fI~/.bashrc\fP, if that file exists and is readable.
It will not do this if invoked as \fBsh\fP.
The
@@ -471,8 +471,8 @@ A \fItoken\fP that performs a control function. It is one of the following
symbols:
.RS
.PP
-.if t \fB\(bv\(bv & && ; ;; ( ) | <newline>\fP
-.if n \fB|| & && ; ;; ( ) | <newline>\fP
+.if t \fB\(bv\(bv & && ; ;; ( ) | |& <newline>\fP
+.if n \fB|| & && ; ;; ( ) | |& <newline>\fP
.RE
.PD
.SH "RESERVED WORDS"
@@ -507,12 +507,13 @@ The return value of a \fIsimple command\fP is its exit status, or
.SS Pipelines
.PP
A \fIpipeline\fP is a sequence of one or more commands separated by
-the character
-.BR | .
+one of the control operators
+.B |
+or \fB|&\fP.
The format for a pipeline is:
.RS
.PP
-[\fBtime\fP [\fB\-p\fP]] [ ! ] \fIcommand\fP [ \fB|\fP \fIcommand2\fP ... ]
+[\fBtime\fP [\fB\-p\fP]] [ ! ] \fIcommand\fP [ [\fB|\fP\(bv\fB|&\fP] \fIcommand2\fP ... ]
.RE
.PP
The standard output of
@@ -524,6 +525,11 @@ command (see
.SM
.B REDIRECTION
below).
+If \fB|&\fP is used, the standard error of \fIcommand\fP is connected to
+\fIcommand2\fP's standard input through the pipe; it is shorthand for
+\fB2>&1 |\fP.
+This implicit redirection of the standard error is performed after any
+redirections specified by the command.
.PP
The return status of a pipeline is the exit status of the last
command, unless the \fBpipefail\fP option is enabled.
@@ -578,7 +584,7 @@ and
have equal precedence, followed by
.B ;
and
-.BR &,
+.BR & ,
which have equal precedence.
.PP
A sequence of one or more newlines may appear in a \fIlist\fP instead
@@ -594,11 +600,9 @@ are executed sequentially; the shell waits for each
command to terminate in turn. The return status is the
exit status of the last command executed.
.PP
-The control operators
-.B &&
-and
-.B \(bv\(bv
-denote AND lists and OR lists, respectively.
+AND and OR lists are sequences of one of more pipelines separated by the
+\fB&&\fP and \fB\(bv\(bv\fP control operators, respectively.
+AND and OR lists are executed with left associativity.
An AND list has the form
.RS
.PP
@@ -620,7 +624,8 @@ An OR list has the form
.I command2
is executed if and only if
.I command1
-returns a non-zero exit status. The return status of
+returns a non-zero exit status.
+The return status of
AND and OR lists is the exit status of the last command
executed in the list.
.SS Compound Commands
@@ -646,7 +651,8 @@ The return status is the exit status of
Note that unlike the metacharacters \fB(\fP and \fB)\fP, \fB{\fP and
\fB}\fP are \fIreserved words\fP and must occur where a reserved
word is permitted to be recognized. Since they do not cause a word
-break, they must be separated from \fIlist\fP by whitespace.
+break, they must be separated from \fIlist\fP by whitespace or another
+shell metacharacter.
.TP
((\fIexpression\fP))
The \fIexpression\fP is evaluated according to the rules described
@@ -696,6 +702,8 @@ If the shell option
.B nocasematch
is enabled, the match is performed without regard to the case
of alphabetic characters.
+Any part of the pattern may be quoted to force it to be matched as a
+string.
Substrings matched by parenthesized subexpressions within the regular
expression are saved in the array variable \fBBASH_REMATCH\fP.
The element of \fBBASH_REMATCH\fP with index 0 is the portion of the string
@@ -818,9 +826,15 @@ If the shell option
.B nocasematch
is enabled, the match is performed without regard to the case
of alphabetic characters.
-When a match is found, the
-corresponding \fIlist\fP is executed. After the first match, no
-subsequent matches are attempted. The exit status is zero if no
+When a match is found, the corresponding \fIlist\fP is executed.
+If the \fB;;\fP operator is used, no subsequent matches are attempted after
+the first pattern match.
+Using \fB;&\fP in place of \fB;;\fP causes execution to continue with
+the \fIlist\fP associated with the next set of patterns.
+Using \fB;;&\fP in place of \fB;;\fP causes the shell to test the next
+pattern list in the statement, if any, and execute any associated \fIlist\fP
+on a successful match.
+The exit status is zero if no
pattern matches. Otherwise, it is the exit status of the
last command executed in \fIlist\fP.
.TP
@@ -857,6 +871,46 @@ The exit status of the \fBwhile\fP and \fBuntil\fP commands
is the exit status
of the last \fBdo\fP \fIlist\fP command executed, or zero if
none was executed.
+.SS Coprocesses
+.PP
+A \fIcoprocess\fP is a shell command preceded by the \fBcoproc\fP reserved
+word.
+A coprocess is executed asynchronously in a subshell, as if the command
+had been terminated with the \fB&\fP control operator, with a two-way pipe
+established between the executing shell and the coprocess.
+.PP
+The format for a coprocess is:
+.RS
+.PP
+\fBcoproc\fP [\fINAME\fP] \fIcommand\fP [\fIredirections\fP]
+.RE
+.PP
+This creates a coprocess named \fINAME\fP.
+If \fINAME\fP is not supplied, the default name is \fICOPROC\fP.
+When the coproc is executed, the shell creates an array variable (see
+.B Arrays
+below) named \fINAME\fP in the context of the executing shell.
+The standard output of
+.I command
+is connected via a pipe to a file descriptor in the executing shell,
+and that file descriptor is assigned to \fINAME\fP[0].
+The standard input of
+.I command
+is connected via a pipe to a file descriptor in the executing shell,
+and that file descriptor is assigned to \fINAME\fP[1].
+This pipe is established before any redirections specified by the
+command (see
+.SM
+.B REDIRECTION
+below).
+The file descriptors can be utilized as arguments to shell commands
+and redirections using standard word expansions.
+The process id of the shell spawned to execute the coprocess is
+available as the value of the variable \fINAME\fP_PID.
+The \fBwait\fP
+builtin command may be used to wait for the coprocess to terminate.
+.PP
+The return status of a coprocess is the exit status of \fIcommand\fP.
.SS Shell Function Definitions
.PP
A shell function is an object that is called like a simple command and
@@ -942,19 +996,19 @@ between single quotes, even when preceded by a backslash.
Enclosing characters in double quotes preserves the literal value
of all characters within the quotes, with the exception of
.BR $ ,
-.BR ` ,
+.BR \` ,
.BR \e ,
and, when history expansion is enabled,
.BR ! .
The characters
.B $
and
-.B `
+.B \`
retain their special meaning within double quotes. The backslash
retains its special meaning only when followed by one of the following
characters:
.BR $ ,
-.BR ` ,
+.BR \` ,
\^\fB"\fP\^,
.BR \e ,
or
@@ -1116,7 +1170,9 @@ When += is applied to an array variable using compound assignment (see
.B Arrays
below), the
variable's value is not unset (as it is when using =), and new values are
-appended to the array beginning at one greater than the array's maximum index.
+appended to the array beginning at one greater than the array's maximum index
+(for indexed arrays) or added as additional key\-value pairs in an
+associative array.
When applied to a string-valued variable, \fIvalue\fP is expanded and
appended to the variable's value.
.SS Positional Parameters
@@ -1185,7 +1241,7 @@ expand to nothing (i.e., they are removed).
Expands to the number of positional parameters in decimal.
.TP
.B ?
-Expands to the status of the most recently executed foreground
+Expands to the exit status of the most recently executed foreground
pipeline.
.TP
.B \-
@@ -1245,9 +1301,20 @@ The following variables are set by the shell:
Expands to the full file name used to invoke this instance of
.BR bash .
.TP
+.B BASHPID
+Expands to the process id of the current \fBbash\fP process.
+This differs from \fB$$\fP under certain circumstances, such as subshells
+that do not require \fBbash\fP to be re-initialized.
+.TP
+.B BASH_ALIASES
+An associative array variable whose members correspond to the internal
+list of aliases as maintained by the \fBalias\fP builtin
+Elements added to this array appear in the alias list; unsetting array
+elements cause aliases to be removed from the alias list.
+.TP
.B BASH_ARGC
An array variable whose values are the number of parameters in each
-frame of the current bash execution call stack.
+frame of the current \fBbash\fP execution call stack.
The number of
parameters to the current subroutine (shell function or script executed
with \fB.\fP or \fBsource\fP) is at the top of the stack.
@@ -1261,7 +1328,7 @@ option to the
builtin below)
.TP
.B BASH_ARGV
-An array variable containing all of the parameters in the current bash
+An array variable containing all of the parameters in the current \fBbash\fP
execution call stack. The final parameter of the last subroutine call
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
@@ -1273,6 +1340,12 @@ option to the
.B shopt
builtin below)
.TP
+.B BASH_CMDS
+An associative array variable whose members correspond to the internal
+hash table of commands as maintained by the \fBhash\fP builtin.
+Elements added to this array appear in the hash table; unsetting array
+elements cause commands to be removed from the hash table.
+.TP
.B BASH_COMMAND
The command currently being executed or about to be executed, unless the
shell is executing a command as the result of a trap,
@@ -1285,7 +1358,9 @@ The command argument to the \fB\-c\fP invocation option.
An array variable whose members are the line numbers in source files
corresponding to each member of \fBFUNCNAME\fP.
\fB${BASH_LINENO[\fP\fI$i\fP\fB]}\fP is the line number in the source
-file where \fB${FUNCNAME[\fP\fI$ifP\fB]}\fP was called.
+file where \fB${FUNCNAME[\fP\fI$i\fP\fB]}\fP was called
+(or \fB${BASH_LINENO[\fP\fI$i-1\fP\fB]}\fP if referenced within another
+shell function).
The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i\fP\fB]}\fB.
Use \fBLINENO\fP to obtain the current line number.
.TP
@@ -1346,6 +1421,10 @@ This variable is available only in shell functions invoked by the
programmable completion facilities (see \fBProgrammable Completion\fP
below).
.TP
+.B COMP_KEY
+The key (or final key of a key sequence) used to invoke the current
+completion function.
+.TP
.B COMP_LINE
The current command line.
This variable is available only in shell functions and external
@@ -1363,6 +1442,20 @@ commands invoked by the
programmable completion facilities (see \fBProgrammable Completion\fP
below).
.TP
+.B COMP_TYPE
+Set to an integer value corresponding to the type of completion attempted
+that caused a completion function to be called:
+\fITAB\fP, for normal completion,
+\fI?\fP, for listing completions after successive tabs,
+\fI!\fP, for listing alternatives on partial word completion,
+\fI@\fP, to list completions if the word is not unmodified,
+or
+\fI%\fP, for menu completion.
+This variable is available only in shell functions and external
+commands invoked by the
+programmable completion facilities (see \fBProgrammable Completion\fP
+below).
+.TP
.B COMP_WORDBREAKS
The set of characters that the Readline library treats as word
separators when performing word completion.
@@ -1410,7 +1503,9 @@ An array variable containing the names of all shell functions
currently in the execution call stack.
The element with index 0 is the name of any currently-executing
shell function.
-The bottom-most element is "main".
+The bottom-most element is
+.if t \f(CW"main"\fP.
+.if n "main".
This variable exists only when a shell function is executing.
Assignments to
.SM
@@ -1727,6 +1822,8 @@ for \fIstrftime\fP(3) to print the time stamp associated with each history
entry displayed by the \fBhistory\fP builtin.
If this variable is set, time stamps are written to the history file so
they may be preserved across shell sessions.
+This uses the history comment character to distinguish timestamps from
+other history lines.
.TP
.B HOME
The home directory of the current user; the default argument for the
@@ -1902,6 +1999,14 @@ had been executed.
If set, the value is executed as a command prior to issuing each primary
prompt.
.TP
+.B PROMPT_DIRTRIM
+If set to a number greater than zero, the value is used as the number of
+trailing directory components to retain when expanding the \fB\ew\fB and
+\fB\eW\fP prompt string escapes (see
+.SM
+.B PROMPTING
+below). Characters removed are replaced with an ellipsis.
+.TP
.B PS1
The value of this parameter is expanded (see
.SM
@@ -2050,26 +2155,35 @@ parser to treat the rest of the line as a comment.
.PD
.SS Arrays
.B Bash
-provides one-dimensional array variables. Any variable may be used as
-an array; the
+provides one-dimensional indexed and associative array variables.
+Any variable may be used as an indexed array; the
.B declare
-builtin will explicitly declare an array. There is no maximum
+builtin will explicitly declare an array.
+There is no maximum
limit on the size of an array, nor any requirement that members
-be indexed or assigned contiguously. Arrays are indexed using
-integers and are zero-based.
+be indexed or assigned contiguously.
+Indexed arrays are referenced using integers (including arithmetic
+expressions) and are zero-based; associative arrays are referenced
+using arbitrary strings.
.PP
-An array is created automatically if any variable is assigned to using
-the syntax \fIname\fP[\fIsubscript\fP]=\fIvalue\fP. The
+An indexed array is created automatically if any variable is assigned to
+using the syntax \fIname\fP[\fIsubscript\fP]=\fIvalue\fP. The
.I subscript
is treated as an arithmetic expression that must evaluate to a number
-greater than or equal to zero. To explicitly declare an array, use
+greater than or equal to zero. To explicitly declare an indexed array,
+use
.B declare \-a \fIname\fP
(see
.SM
.B SHELL BUILTIN COMMANDS
below).
.B declare \-a \fIname\fP[\fIsubscript\fP]
-is also accepted; the \fIsubscript\fP is ignored. Attributes may be
+is also accepted; the \fIsubscript\fP is ignored.
+.PP
+Associative arrays are created using
+.BR "declare \-A \fIname\fP" .
+.PP
+Attributes may be
specified for an array variable using the
.B declare
and
@@ -2078,11 +2192,15 @@ builtins. Each attribute applies to all members of an array.
.PP
Arrays are assigned to using compound assignments of the form
\fIname\fP=\fB(\fPvalue\fI1\fP ... value\fIn\fP\fB)\fP, where each
-\fIvalue\fP is of the form [\fIsubscript\fP]=\fIstring\fP. Only
-\fIstring\fP is required. If
-the optional brackets and subscript are supplied, that index is assigned to;
+\fIvalue\fP is of the form [\fIsubscript\fP]=\fIstring\fP.
+Indexed array assignments do not require the bracket and subscript.
+When assigning to indexed arrays, if the optional brackets and subscript
+are supplied, that index is assigned to;
otherwise the index of the element assigned is the last index assigned
to by the statement plus one. Indexing starts at zero.
+.PP
+When assigning to an associative array, the subscript is required.
+.PP
This syntax is also accepted by the
.B declare
builtin. Individual array elements may be assigned to using the
@@ -2113,7 +2231,7 @@ above). ${#\fIname\fP[\fIsubscript\fP]} expands to the length of
${\fIname\fP[\fIsubscript\fP]}. If \fIsubscript\fP is \fB*\fP or
\fB@\fP, the expansion is the number of elements in the array.
Referencing an array variable without a subscript is equivalent to
-referencing element zero.
+referencing the array with a subscript of 0.
.PP
The
.B unset
@@ -2132,7 +2250,10 @@ and
.B readonly
builtins each accept a
.B \-a
-option to specify an array. The
+option to specify an indexed array and a
+.B \-A
+option to specify an associative array.
+The
.B read
builtin accepts a
.B \-a
@@ -2193,13 +2314,21 @@ Brace expansions may be nested. The results of each expanded
string are not sorted; left to right order is preserved.
For example, a\fB{\fPd,c,b\fB}\fPe expands into `ade ace abe'.
.PP
-A sequence expression takes the form \fB{\fP\fIx\fP\fB..\fP\fIy\fP\fB}\fP,
-where \fIx\fP and \fIy\fP are either integers or single characters.
+A sequence expression takes the form
+\fB{\fP\fIx\fP\fB..\fP\fIy\fP\fB[..\fP\fIincr\fP\fB]}\fP,
+where \fIx\fP and \fIy\fP are either integers or single characters,
+and \fIincr\fP, an optional increment, is an integer.
When integers are supplied, the expression expands to each number between
\fIx\fP and \fIy\fP, inclusive.
+Supplied integers may be prefixed with \fI0\fP to force each term to have the
+same width. When either \fIx\fP or \fPy\fP begins with a zero, the shell
+attempts to force all generated terms to contain the same number of digits,
+zero-padding where necessary.
When characters are supplied, the expression expands to each character
lexicographically between \fIx\fP and \fIy\fP, inclusive. Note that
both \fIx\fP and \fIy\fP must be of the same type.
+When the increment is supplied, it is used as the difference between
+each term. The default increment is 1 or -1 as appropriate.
.PP
Brace expansion is performed before any other expansions,
and any characters special to other expansions are preserved
@@ -2422,32 +2551,40 @@ If \fIoffset\fP evaluates to a number less than zero, the value
is used as an offset from the end of the value of \fIparameter\fP.
If \fIparameter\fP is \fB@\fP, the result is \fIlength\fP positional
parameters beginning at \fIoffset\fP.
-If \fIparameter\fP is an array name indexed by @ or *,
+If \fIparameter\fP is an indexed array name subscripted by @ or *,
the result is the \fIlength\fP
members of the array beginning with ${\fIparameter\fP[\fIoffset\fP]}.
A negative \fIoffset\fP is taken relative to one greater than the maximum
index of the specified array.
+Substring expansion applied to an associative array produces undefined
+results.
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the :- expansion.
Substring indexing is zero-based unless the positional parameters
-are used, in which case the indexing starts at 1.
+are used, in which case the indexing starts at 1 by default.
+If \fIoffset\fP is 0, and the positional parameters are used, \fB$0\fP is
+prefixed to the list.
.TP
${\fB!\fP\fIprefix\fP\fB*\fP}
.PD 0
.TP
${\fB!\fP\fIprefix\fP\fB@\fP}
.PD
+\fBNames matching prefix.\fP
Expands to the names of variables whose names begin with \fIprefix\fP,
separated by the first character of the
.SM
.B IFS
special variable.
+When \fI@\fP is used and the expansion appears within double quotes, each
+variable name expands to a separate word.
.TP
${\fB!\fP\fIname\fP[\fI@\fP]}
.PD 0
.TP
${\fB!\fP\fIname\fP[\fI*\fP]}
.PD
+\fBList of array keys.\fP
If \fIname\fP is an array variable, expands to the list of array indices
(keys) assigned in \fIname\fP.
If \fIname\fP is not an array, expands to 0 if \fIname\fP is set and null
@@ -2456,6 +2593,7 @@ When \fI@\fP is used and the expansion appears within double quotes, each
key expands to a separate word.
.TP
${\fB#\fP\fIparameter\fP}
+\fBParameter length.\fP
The length in characters of the value of \fIparameter\fP is substituted.
If
.I parameter
@@ -2477,6 +2615,7 @@ ${\fIparameter\fP\fB#\fP\fIword\fP}
.TP
${\fIparameter\fP\fB##\fP\fIword\fP}
.PD
+\fBRemove matching prefix pattern.\fP
The
.I word
is expanded to produce a pattern just as in pathname
@@ -2509,6 +2648,7 @@ ${\fIparameter\fP\fB%\fP\fIword\fP}
.TP
${\fIparameter\fP\fB%%\fP\fIword\fP}
.PD
+\fBRemove matching suffix pattern.\fP
The \fIword\fP is expanded to produce a pattern just as in
pathname expansion.
If the pattern matches a trailing portion of the expanded value of
@@ -2535,11 +2675,12 @@ the pattern removal operation is applied to each member of the
array in turn, and the expansion is the resultant list.
.TP
${\fIparameter\fP\fB/\fP\fIpattern\fP\fB/\fP\fIstring\fP}
+\fBPattern substitution.\fP
The \fIpattern\fP is expanded to produce a pattern just as in
pathname expansion.
\fIParameter\fP is expanded and the longest match of \fIpattern\fP
against its value is replaced with \fIstring\fP.
-If \Ipattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
+If \fIpattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
replaced with \fIstring\fP. Normally only the first match is replaced.
If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
of the expanded value of \fIparameter\fP.
@@ -2563,6 +2704,44 @@ or
.BR * ,
the substitution operation is applied to each member of the
array in turn, and the expansion is the resultant list.
+.TP
+${\fIparameter\fP\fB^\fP\fIpattern\fP}
+.PD 0
+.TP
+${\fIparameter\fP\fB^^\fP\fIpattern\fP}
+.TP
+${\fIparameter\fP\fB,\fP\fIpattern\fP}
+.TP
+${\fIparameter\fP\fB,,\fP\fIpattern\fP}
+.PD
+\fBCase modification.\fP
+This expansion modifies the case of alphabetic characters in \fIparameter\fP.
+The \fIpattern\fP is expanded to produce a pattern just as in
+pathname expansion.
+The \fB^\fP operator converts lowercase letters matching \fIpattern\fP
+to uppercase; the \fB,\fP operator converts matching uppercase letters
+to lowercase.
+The \fB^^\fP and \fB,,\fP expansions convert each matched character in the
+expanded value; the \fB^\fP and \fB,\fP expansions match and convert only
+the first character.
+If \fIpattern\fP is omitted, it is treated like a \fB?\fP, which matches
+every character.
+If
+.I parameter
+is
+.B @
+or
+.BR * ,
+the case modification operation is applied to each positional
+parameter in turn, and the expansion is the resultant list.
+If
+.I parameter
+is an array variable subscripted with
+.B @
+or
+.BR * ,
+the case modification operation is applied to each member of the
+array in turn, and the expansion is the resultant list.
.SS Command Substitution
.PP
\fICommand substitution\fP allows the output of a command to replace
@@ -2574,7 +2753,7 @@ the command name. There are two forms:
.RE
or
.RS
-\fB`\fP\fIcommand\fP\fB`\fP
+\fB\`\fP\fIcommand\fP\fB\`\fP
.RE
.PP
.B Bash
@@ -2589,7 +2768,7 @@ the equivalent but faster \fB$(< \fIfile\fP)\fR.
When the old-style backquote form of substitution is used,
backslash retains its literal meaning except when followed by
.BR $ ,
-.BR ` ,
+.BR \` ,
or
.BR \e .
The first backquote not preceded by a backslash terminates the
@@ -2668,10 +2847,18 @@ is unset, or its
value is exactly
.BR <space><tab><newline> ,
the default, then
+sequences of
+.BR <space> ,
+.BR <tab> ,
+and
+.B <newline>
+at the beginning and end of the results of the previous
+expansions are ignored, and
any sequence of
.SM
.B IFS
-characters serves to delimit words. If
+characters not at the beginning or end serves to delimit words.
+If
.SM
.B IFS
has a value other than the default, then sequences of
@@ -2735,7 +2922,7 @@ file names matching the pattern.
If no matching file names are found,
and the shell option
.B nullglob
-is disabled, the word is left unchanged.
+is not enabled, the word is left unchanged.
If the
.B nullglob
option is set, and no matches are found,
@@ -2829,6 +3016,12 @@ The special pattern characters have the following meanings:
.TP
.B *
Matches any string, including the null string.
+When the \fBglobstar\fP shell option is enabled, and \fB*\fP is used in
+a filename expansion context, two adjacent \fB*\fPs used as a single
+pattern will match all files and zero or more directories and
+subdirectories.
+If followed by a \fB/\fP, two adjacent \fB*\fPs will match only directories
+and subdirectories.
.TP
.B ?
Matches any single character.
@@ -3092,14 +3285,12 @@ The general format for appending output is:
.PP
.SS Redirecting Standard Output and Standard Error
.PP
-.B Bash
-allows both the
+This construct allows both the
standard output (file descriptor 1) and
the standard error output (file descriptor 2)
to be redirected to the file whose name is the
expansion of
-.I word
-with this construct.
+.IR word .
.PP
There are two formats for redirecting standard output and
standard error:
@@ -3118,11 +3309,32 @@ This is semantically equivalent to
.PP
\fB>\fP\fIword\fP 2\fB>&\fP1
.RE
+.PP
+.SS Appending Standard Output and Standard Error
+.PP
+This construct allows both the
+standard output (file descriptor 1) and
+the standard error output (file descriptor 2)
+to be appended to the file whose name is the
+expansion of
+.IR word .
+.PP
+The format for appending standard output and standard error is:
+.RS
+.PP
+\fB&>>\fP\fIword\fP
+.RE
+.PP
+This is semantically equivalent to
+.RS
+.PP
+\fB>>\fP\fIword\fP 2\fB>&\fP1
+.RE
.SS Here Documents
.PP
This type of redirection instructs the shell to read input from the
current source until a line containing only
-.I word
+.I delimiter
(with no trailing blanks)
is seen. All of
the lines read up to that point are then used as the standard
@@ -3159,7 +3371,7 @@ must be used to quote the characters
.BR \e ,
.BR $ ,
and
-.BR ` .
+.BR \` .
.PP
If the redirection operator is
.BR <<\- ,
@@ -3273,7 +3485,7 @@ below).
The first word of each simple command, if unquoted,
is checked to see if it has an
alias. If so, that word is replaced by the text of the alias.
-The characters \fB/\fP, \fB$\fP, \fB`\fP, and \fB=\fP and
+The characters \fB/\fP, \fB$\fP, \fB\`\fP, and \fB=\fP and
any of the shell \fImetacharacters\fP or quoting characters
listed above may not appear in an alias name.
The replacement text may contain any valid shell input,
@@ -3748,7 +3960,12 @@ A full search of the directories in
.SM
.B PATH
is performed only if the command is not found in the hash table.
-If the search is unsuccessful, the shell prints an error
+If the search is unsuccessful, the shell searches for a defined shell
+function named \fBcommand_not_found_handle\fP.
+If that function exists, it is invoked with the original command and
+the original command's arguments as its arguments, and the function's
+exit status becomes the exit status of the shell.
+If that function is not defined, the shell prints an error
message and returns an exit status of 127.
.PP
If the search is successful, or if the command name contains
@@ -3845,6 +4062,10 @@ commands that are invoked as part of a pipeline are also executed in a
subshell environment. Changes made to the subshell environment
cannot affect the shell's execution environment.
.PP
+Subshells spawned to execute command substitutions inherit the value of
+the \fB\-e\fP option from the parent shell. When not in posix mode,
+Bash clears the \fB\-e\fP option in such subshells.
+.PP
If a command is followed by a \fB&\fP and job control is not active, the
default standard input for the command is the empty file \fI/dev/null\fP.
Otherwise, the invoked command inherits the file descriptors of the calling
@@ -3906,6 +4127,15 @@ invokes an external command, the variable
is set to the full file name of the command and passed to that
command in its environment.
.SH "EXIT STATUS"
+.PP
+The exit status of an executed command is the value returned by the
+\fIwaitpid\fP system call or equivalent function. Exit statuses
+fall between 0 and 255, though, as explained below, the shell may
+use values above 125 specially. Exit statuses from shell builtins and
+compound commands are also limited to this range. Under certain
+circumstances, the shell will use special values to indicate specific
+failure modes.
+.PP
For the shell's purposes, a command which exits with a
zero exit status has succeeded. An exit status of zero
indicates success. A non-zero exit status indicates failure.
@@ -4102,7 +4332,7 @@ and typeahead to be discarded.
There are a number of ways to refer to a job in the shell.
The character
.B %
-introduces a job name. Job number
+introduces a job specification (\fIjobspec\fP). Job number
.I n
may be referred to as
.BR %n .
@@ -4132,6 +4362,8 @@ The
.I "previous job"
may be referenced using
.BR %\- .
+If there is only a single job, \fB%+\fP and \fB%\-\fP can both be used
+to refer to that job.
In output pertaining to jobs (e.g., the output of the
.B jobs
command), the current job is always flagged with a
@@ -4172,11 +4404,15 @@ is executed for each child that exits.
.PP
If an attempt to exit
.B bash
-is made while jobs are stopped, the shell prints a warning message. The
+is made while jobs are stopped (or, if the \fBcheckjobs\fP shell option has
+been enabled using the \fBshopt\fP builtin, running), the shell prints a
+warning message, and, if the \fBcheckjobs\fP option is enabled, lists the
+jobs and their statuses.
+The
.B jobs
-command may then be used to inspect their status.
+command may then be used to inspect their status.
If a second attempt to exit is made without an intervening command,
-the shell does not print another warning, and the stopped
+the shell does not print another warning, and any stopped
jobs are terminated.
.SH PROMPTING
When executing interactively,
@@ -4254,6 +4490,7 @@ the release of \fBbash\fP, version + patch level (e.g., 2.00.0)
.TP
.B \ew
the current working directory, with \fB$HOME\fP abbreviated with a tilde
+(uses the \fB$PROMPT_DIRTRIM\fP variable)
.TP
.B \eW
the basename of the current working directory, with \fB$HOME\fP
@@ -4309,18 +4546,27 @@ This is the library that handles reading input when using an interactive
shell, unless the
.B \-\-noediting
option is given at shell invocation.
+Line editing is also used when using the \fB\-e\fP option to the
+\fBread\fP builtin.
By default, the line editing commands are similar to those of emacs.
A vi-style line editing interface is also available.
-To turn off line editing after the shell is running, use the
-.B +o emacs
+Line editing can be enabled at any time using the
+.B \-o emacs
or
-.B +o vi
+.B \-o vi
options to the
.B set
builtin (see
.SM
.B SHELL BUILTIN COMMANDS
below).
+To turn off line editing after the shell is running, use the
+.B +o emacs
+or
+.B +o vi
+options to the
+.B set
+builtin.
.SS "Readline Notation"
.PP
In this section, the emacs-style notation is used to denote
@@ -4611,6 +4857,12 @@ in vi command mode.
If set to \fBOn\fP, readline performs filename matching and completion
in a case\-insensitive fashion.
.TP
+.B completion\-prefix\-display\-length (0)
+The length in characters of the common prefix of a list of possible
+completions that is displayed without modification. When set to a
+value greater than zero, common prefixes longer than this value are
+replaced with an ellipsis when displaying possible completions.
+.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
the number of possible completions
@@ -4655,6 +4907,10 @@ If set to \fBon\fP, the history code attempts to place point at the
same location on each history line retrieved with \fBprevious-history\fP
or \fBnext-history\fP.
.TP
+.B history\-size (0)
+Set the maximum number of history entries saved in the history list. If
+set to zero, the number of entries in the history list is not limited.
+.TP
.B horizontal\-scroll\-mode (Off)
When set to \fBOn\fP, makes readline use a single line for display,
scrolling the input horizontally on a single screen line when it
@@ -4716,6 +4972,12 @@ to display a screenful of possible completions at a time.
.B print\-completions\-horizontally (Off)
If set to \fBOn\fP, readline will display completions with matches
sorted horizontally in alphabetical order, rather than down the screen.
+.TP
+.B revert\-all\-at\-newline (Off)
+If set to \fBon\fP, readline will undo all changes to history lines
+before returning when \fBaccept\-line\fP is executed. By default,
+history lines may be modified and retain individual undo lists across
+calls to \fBreadline\fP.
.TP
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
@@ -4880,8 +5142,16 @@ Move forward to the end of the next word. Words are composed of
alphanumeric characters (letters and digits).
.TP
.B backward\-word (M\-b)
-Move back to the start of the current or previous word. Words are
-composed of alphanumeric characters (letters and digits).
+Move back to the start of the current or previous word.
+Words are composed of alphanumeric characters (letters and digits).
+.TP
+.B shell\-forward\-word
+Move forward to the end of the next word.
+Words are delimited by non-quoted shell metacharacters.
+.TP
+.B shell\-backward\-word
+Move back to the start of the current or previous word.
+Words are delimited by non-quoted shell metacharacters.
.TP
.B clear\-screen (C\-l)
Clear the screen leaving the current line at the top of the screen.
@@ -5010,7 +5280,7 @@ Invoke an editor on the current command line, and execute the result as shell
commands.
\fBBash\fP attempts to invoke
.SM
-.BR $FCEDIT ,
+.BR $VISUAL ,
.SM
.BR $EDITOR ,
and \fIemacs\fP as the editor, in that order.
@@ -5109,6 +5379,15 @@ Word boundaries are the same as those used by \fBforward\-word\fP.
Kill the word behind point.
Word boundaries are the same as those used by \fBbackward\-word\fP.
.TP
+.B shell\-kill\-word (M\-d)
+Kill from point to the end of the current word, or if between
+words, to the end of the next word.
+Word boundaries are the same as those used by \fBshell\-forward\-word\fP.
+.TP
+.B shell\-backward\-kill\-word (M\-Rubout)
+Kill the word behind point.
+Word boundaries are the same as those used by \fBshell\-backward\-word\fP.
+.TP
.B unix\-word\-rubout (C\-w)
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
@@ -5255,6 +5534,11 @@ Attempt completion on the text before point, comparing
the text against lines from the history list for possible
completion matches.
.TP
+.B dabbrev\-expand
+Attempt menu completion on the text before point, comparing
+the text against lines from the history list for possible
+completion matches.
+.TP
.B complete\-into\-braces (M\-{)
Perform filename completion and insert the list of possible completions
enclosed within braces so the list is available to the shell (see
@@ -5453,10 +5737,14 @@ After these matches have been generated, any shell function or command
specified with the \fB\-F\fP and \fB\-C\fP options is invoked.
When the command or function is invoked, the
.SM
-.B COMP_LINE
+.BR COMP_LINE ,
+.SM
+.BR COMP_POINT ,
+.SM
+.BR COMP_KEY ,
and
.SM
-.B COMP_POINT
+.B COMP_TYPE
variables are assigned values as described above under
\fBShell Variables\fP.
If a shell function is being invoked, the
@@ -5566,6 +5854,13 @@ is truncated, if necessary, to contain no more than
the number of lines specified by the value of
.SM
.BR HISTFILESIZE .
+When the history file is read,
+lines beginning with the history comment character followed immediately
+by a digit are interpreted as timestamps for the preceding history line.
+These timestamps are optionally displayed depending on the value of the
+.SM
+.B HISTTIMEFORMAT
+variable.
When an interactive shell exits, the last
.SM
.B $HISTSIZE
@@ -5586,7 +5881,16 @@ If
.SM
.B HISTFILE
is unset, or if the history file is unwritable, the history is
-not saved. After saving the history, the history file is truncated
+not saved.
+If the
+.SM
+.HISTTIMEFORMAT
+variable is set, time stamps are written to the history file, marked
+with the history comment character, so
+they may be preserved across shell sessions.
+This uses the history comment character to distinguish timestamps from
+other history lines.
+After saving the history, the history file is truncated
to contain no more than
.SM
.B HISTFILESIZE
@@ -5720,6 +6024,9 @@ history expansion mechanism (see the description of
.B histchars
above under
.BR "Shell Variables" ).
+The shell uses
+the history comment character to mark history timestamps when
+writing the history file.
.SS Event Designators
.PP
An event designator is a reference to a command line entry in the
@@ -5979,8 +6286,9 @@ no alias has been defined.
Resume each suspended job \fIjobspec\fP in the background, as if it
had been started with
.BR & .
-If \fIjobspec\fP is not present, the shell's notion of the
-\fIcurrent job\fP is used.
+If
+.I jobspec
+is not present, the shell's notion of the \fIcurrent job\fP is used.
.B bg
.I jobspec
returns 0 unless run when job control is disabled or, when run with
@@ -6038,13 +6346,6 @@ that they can be re-read.
.B \-P
List current \fBreadline\fP function names and bindings.
.TP
-.B \-v
-Display \fBreadline\fP variable names and values in such a way that they
-can be re-read.
-.TP
-.B \-V
-List current \fBreadline\fP variable names and values.
-.TP
.B \-s
Display \fBreadline\fP key sequences bound to macros and the strings
they output in such a way that they can be re-read.
@@ -6053,6 +6354,13 @@ they output in such a way that they can be re-read.
Display \fBreadline\fP key sequences bound to macros and the strings
they output.
.TP
+.B \-v
+Display \fBreadline\fP variable names and values in such a way that they
+can be re-read.
+.TP
+.B \-V
+List current \fBreadline\fP variable names and values.
+.TP
.B \-f \fIfilename\fP
Read key bindings from \fIfilename\fP.
.TP
@@ -6068,6 +6376,16 @@ Remove any current binding for \fIkeyseq\fP.
.B \-x \fIkeyseq\fP:\fIshell\-command\fP
Cause \fIshell\-command\fP to be executed whenever \fIkeyseq\fP is
entered.
+When \fIshell\-command\fP is executed, the shell sets the
+.B READLINE_LINE
+variable to the contents of the \fBreadline\fP line buffer and the
+.B READLINE_POINT
+variable to the current location of the insertion point.
+If the executed command changes the value of
+.B READLINE_LINE
+or
+.BR READLINE_POINT ,
+those new values will be reflected in the editing state.
.PD
.PP
The return value is 0 unless an unrecognized option is given or an
@@ -6086,10 +6404,8 @@ loop. If \fIn\fP is specified, break \fIn\fP levels.
must be \(>= 1. If
.I n
is greater than the number of enclosing loops, all enclosing loops
-are exited. The return value is 0 unless the shell is not executing
-a loop when
-.B break
-is executed.
+are exited.
+The return value is 0 unless \fIn\fP is not greater than or equal to 1.
.TP
\fBbuiltin\fP \fIshell\-builtin\fP [\fIarguments\fP]
Execute the specified shell builtin, passing it
@@ -6103,6 +6419,20 @@ The return status is false if
.I shell\-builtin
is not a shell builtin command.
.TP
+\fBcaller\fP [\fIexpr\fP]
+Returns the context of any active subroutine call (a shell function or
+a script executed with the \fB.\fP or \fBsource\fP builtins.
+Without \fIexpr\fP, \fBcaller\fP displays the line number and source
+filename of the current subroutine call.
+If a non-negative integer is supplied as \fIexpr\fP, \fBcaller\fP
+displays the line number, subroutine name, and source file corresponding
+to that position in the current execution call stack. This extra
+information may be used, for example, to print a stack trace. The
+current frame is frame 0.
+The return value is 0 unless the shell is not executing a subroutine
+call or \fIexpr\fP does not correspond to a valid position in the
+call stack.
+.TP
\fBcd\fP [\fB\-L|-P\fP] [\fIdir\fP]
Change the current directory to \fIdir\fP. The variable
.SM
@@ -6148,20 +6478,6 @@ written to the standard output.
The return value is true if the directory was successfully changed;
false otherwise.
.TP
-\fBcaller\fP [\fIexpr\fP]
-Returns the context of any active subroutine call (a shell function or
-a script executed with the \fB.\fP or \fBsource\fP builtins.
-Without \fIexpr\fP, \fBcaller\fP displays the line number and source
-filename of the current subroutine call.
-If a non-negative integer is supplied as \fIexpr\fP, \fBcaller\fP
-displays the line number, subroutine name, and source file corresponding
-to that position in the current execution call stack. This extra
-information may be used, for example, to print a stack trace. The
-current frame is frame 0.
-The return value is 0 unless the shell is not executing a subroutine
-call or \fIexpr\fP does not correspond to a valid position in the
-call stack.
-.TP
\fBcommand\fP [\fB\-pVv\fP] \fIcommand\fP [\fIarg\fP ...]
Run
.I command
@@ -6225,12 +6541,12 @@ will be displayed.
The return value is true unless an invalid option is supplied, or no
matches were generated.
.TP
-\fBcomplete\fP [\fB\-abcdefgjksuv\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP]
+\fBcomplete\fP [\fB\-abcdefgjksuv\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-E\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP]
.br
-[\fB\-X\fP \fIfilterpat\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP] \fIname\fP [\fIname ...\fP]
+[\fB\-X\fP \fIfilterpat\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP] \fIname\fP [\fIname ...\fP]
.PD 0
.TP
-\fBcomplete\fP \fB\-pr\fP [\fIname\fP ...]
+\fBcomplete\fP \fB\-pr\fP [\fB\-E\fP] [\fIname\fP ...]
.PD
Specify how arguments to each \fIname\fP should be completed.
If the \fB\-p\fP option is supplied, or if no options are supplied,
@@ -6239,6 +6555,9 @@ them to be reused as input.
The \fB\-r\fP option removes a completion specification for
each \fIname\fP, or, if no \fIname\fPs are supplied, all
completion specifications.
+The \fB\-E\fP option indicates that the remaining options and actions should
+apply to ``empty'' command completion; that is, completion attempted on a
+blank line.
.sp 1
The process of applying these completion specifications when word completion
is attempted is described above under \fBProgrammable Completion\fP.
@@ -6271,8 +6590,9 @@ Perform directory name completion if the compspec generates no matches.
.TP 8
.B filenames
Tell readline that the compspec generates filenames, so it can perform any
-filename\-specific processing (like adding a slash to directory names or
-suppressing trailing spaces). Intended to be used with shell functions.
+filename\-specific processing (like adding a slash to directory names,
+quoting special characters, or suppressing trailing spaces).
+Intended to be used with shell functions.
.TP 8
.B nospace
Tell readline not to append a space (the default) to words completed at
@@ -6414,6 +6734,19 @@ a \fIname\fP for which no specification exists, or
an error occurs adding a completion specification.
.RE
.TP
+\fBcompopt\fP [\fB\-o\fP \fIoption\fP] [\fB+o\fP \fIoption\fP] [\fIname\fP]
+Modify completion options for each \fIname\fP according to the
+\fIoption\fPs, or for the
+currently-execution completion if no \fIname\fPs are supplied.
+If no \fIoption\fPs are given, display the completion options for each
+\fIname\fP or the current completion.
+The possible values of \fIoption\fP are those valid for the \fBcomplete\fP
+builtin described above.
+.PP
+The return value is true unless an invalid option is supplied, an attempt
+is made to modify the options for a \fIname\fP for which no completion
+specification exists, or an output error occurs.
+.TP
\fBcontinue\fP [\fIn\fP]
Resume the next iteration of the enclosing
.BR for ,
@@ -6429,15 +6762,13 @@ is specified, resume at the \fIn\fPth enclosing loop.
must be \(>= 1. If
.I n
is greater than the number of enclosing loops, the last enclosing loop
-(the ``top-level'' loop) is resumed. The return value is 0 unless the
-shell is not executing a loop when
-.B continue
-is executed.
+(the ``top-level'' loop) is resumed.
+The return value is 0 unless \fIn\fP is not greater than or equal to 1.
.TP
-\fBdeclare\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
+\fBdeclare\fP [\fB\-aAfFilrtux\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
.PD 0
.TP
-\fBtypeset\fP [\fB\-afFirtx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
+\fBtypeset\fP [\fB\-aAfFilrtux\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...]
.PD
Declare variables and/or give them attributes.
If no \fIname\fPs are given then display the values of variables.
@@ -6447,7 +6778,15 @@ option will display the attributes and values of each
.IR name .
When
.B \-p
-is used, additional options are ignored.
+is used with \fIname\fP arguments, additional options are ignored.
+When
+.B \-p
+is supplied without \fIname\fP arguments, it will display the attributes
+and values of all variables having the attributes specified by the
+additional options.
+If no other options are supplied with \fB\-p\fP, \fBdeclare\fP will display
+the attributes and values of all shell variables. The \fB\-f\fP option
+will restrict the display to shell functions.
The
.B \-F
option inhibits the display of function definitions; only the
@@ -6465,7 +6804,12 @@ to give variables attributes:
.PD 0
.TP
.B \-a
-Each \fIname\fP is an array variable (see
+Each \fIname\fP is an indexed array variable (see
+.B Arrays
+above).
+.TP
+.B \-A
+Each \fIname\fP is an associative array variable (see
.B Arrays
above).
.TP
@@ -6478,6 +6822,11 @@ The variable is treated as an integer; arithmetic evaluation (see
.B "ARITHMETIC EVALUATION" ") "
is performed when the variable is assigned a value.
.TP
+.B \-l
+When the variable is assigned a value, all upper-case characters are
+converted to lower-case.
+The upper-case attribute is disabled.
+.TP
.B \-r
Make \fIname\fPs readonly. These names cannot then be assigned values
by subsequent assignment statements or unset.
@@ -6488,13 +6837,21 @@ Traced functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps from
the calling shell.
The trace attribute has no special meaning for variables.
.TP
+.B \-u
+When the variable is assigned a value, all lower-case characters are
+converted to upper-case.
+The lower-case attribute is disabled.
+.TP
.B \-x
Mark \fIname\fPs for export to subsequent commands via the environment.
.PD
.PP
Using `+' instead of `\-'
-turns off the attribute instead, with the exception that \fB+a\fP
-may not be used to destroy an array variable. When used in a function,
+turns off the attribute instead,
+with the exceptions that \fB+a\fP
+may not be used to destroy an array variable and \fB+r\fB will not
+remove the readonly attribute.
+When used in a function,
makes each
\fIname\fP local, as with the
.B local
@@ -6515,7 +6872,7 @@ an attempt is made to turn off array status for an array variable,
or an attempt is made to display a non-existent function with \fB\-f\fP.
.RE
.TP
-.B dirs [\fB\-clpv\fP] [+\fIn\fP] [\-\fIn\fP]
+.B dirs [+\fIn\fP] [\-\fIn\fP] [\fB\-cplv\fP]
Without options, displays the list of currently remembered directories.
The default display is on a single line with directory names separated
by spaces.
@@ -6563,6 +6920,10 @@ of the directory stack.
Without options, each
.I jobspec
is removed from the table of active jobs.
+If
+.I jobspec
+is not present, and neither \fB\-a\fB nor \fB\-r\fP is supplied,
+the shell's notion of the \fIcurrent job\fP is used.
If the \fB\-h\fP option is given, each
.I jobspec
is not removed from the table, but is marked so that
@@ -6617,7 +6978,7 @@ alert (bell)
backspace
.TP
.B \ec
-suppress trailing newline
+suppress further output
.TP
.B \ee
an escape character
@@ -6650,7 +7011,7 @@ the eight-bit character whose value is the hexadecimal value \fIHH\fP
.PD
.RE
.TP
-\fBenable\fP [\fB\-adnps\fP] [\fB\-f\fP \fIfilename\fP] [\fIname\fP ...]
+\fBenable\fP [\fB\-a\fP] [\fB\-dnps\fP] [\fB\-f\fP \fIfilename\fP] [\fIname\fP ...]
Enable and disable builtin shell commands.
Disabling a builtin allows a disk command which has the same name
as a shell builtin to be executed without specifying a full pathname,
@@ -6711,7 +7072,7 @@ become the arguments to \fIcommand\fP.
If the
.B \-l
option is supplied,
-the shell places a dash at the beginning of the zeroth arg passed to
+the shell places a dash at the beginning of the zeroth argument passed to
.IR command .
This is what
.IR login (1)
@@ -6782,7 +7143,7 @@ is supplied with a
.I name
that is not a function.
.TP
-\fBfc\fP [\fB\-e\fP \fIename\fP] [\fB\-nlr\fP] [\fIfirst\fP] [\fIlast\fP]
+\fBfc\fP [\fB\-e\fP \fIename\fP] [\fB\-lnr\fP] [\fIfirst\fP] [\fIlast\fP]
.PD 0
.TP
\fBfc\fP \fB\-s\fP [\fIpat\fP=\fIrep\fP] [\fIcmd\fP]
@@ -7027,7 +7388,7 @@ The return status is true unless a
.I name
is not found or an invalid option is supplied.
.TP
-\fBhelp\fP [\fB\-s\fP] [\fIpattern\fP]
+\fBhelp\fP [\fB\-dms\fP] [\fIpattern\fP]
Display helpful information about builtin commands. If
.I pattern
is specified,
@@ -7036,8 +7397,19 @@ gives detailed help on all commands matching
.IR pattern ;
otherwise help for all the builtins and shell control structures
is printed.
-The \fB\-s\fP option restricts the information displayed to a short
-usage synopsis.
+.RS
+.PD 0
+.TP
+.B \-d
+Display a short description of each \fIpattern\fP
+.TP
+.B \ -m
+Display the description of each \fIpattern\fP in a manpage-like format
+.TP
+.B \-s
+Display only a short usage synopsis for each \fIpattern\fP
+.PD
+.RE
The return status is 0 unless no command matches
.IR pattern .
.TP
@@ -7116,7 +7488,11 @@ are added.
.PD
.PP
If the \fBHISTTIMEFORMAT\fP is set, the time stamp information
-associated with each history entry is written to the history file.
+associated with each history entry is written to the history file,
+marked with the history comment character.
+When the history file is read, lines beginning with the history
+comment character followed immediately by a digit are interpreted
+as timestamps for the previous history line.
The return value is 0 unless an invalid option is encountered, an
error occurs while reading or writing the history file, an invalid
\fIoffset\fP is supplied as an argument to \fB\-d\fP, or the
@@ -7259,6 +7635,64 @@ is supplied, or
.B logout
Exit a login shell.
.TP
+\fBmapfile\fP [\fB\-n\fP \fIcount\fP] [\fB\-O\fP \fIorigin\fP] [\fB\-s\fP \fIcount\fP] [\fB\-t\fP] [\fB\-u\fP \fIfd\fP] [\fB\-C\fP \fIcallback\fP] [\fB\-c\fP \fIquantum\fP] [\fIarray\fP]
+Read lines from the standard input into array variable
+.IR array ,
+or from file descriptor
+.IR fd
+if the
+.B \-u
+option is supplied.
+The variable \fBMAPFILE\fP is the default \fIarray\fP.
+Options, if supplied, have the following meanings:
+.RS
+.PD 0
+.TP
+.B \-n
+Copy at most
+.I count
+lines. If \fIcount\fP is 0, all lines are copied.
+.TP
+.B \-O
+Begin assigning to
+.I array
+at index
+.IR origin .
+The default index is 0.
+.TP
+.B \-s
+Discard the first \fIcount\fP lines read.
+.TP
+.B \-t
+Remove a trailing line from each line read.
+.TP
+.B \-u
+Read lines from file descriptor \fIfd\fP instead of the standard input.
+.TP
+.B \-C
+Evaluate
+.I callback
+each time \fIquantum\fP lines are read. The \fB\-c\fP option specifies
+.IR quantum .
+.TP
+.B \-c
+Specify the number of lines read between each call to
+.IR callback .
+.PD
+.PP
+If
+.B \-C
+is specified without
+.BR \-c ,
+the default quantum is 5000.
+.PP
+If not supplied with an explicit origin, \fBmapfile\fP will clear \fIarray\fP
+before assigning to it.
+.PP
+\fBmapfile\fP returns successfully unless an invalid option or option
+argument is supplied, or \fIarray\fP is invalid or unassignable.
+.RE
+.TP
\fBpopd\fP [\-\fBn\fP] [+\fIn\fP] [\-\fIn\fP]
Removes entries from the directory stack. With no arguments,
removes the top directory from the stack, and performs a
@@ -7268,6 +7702,10 @@ Arguments, if supplied, have the following meanings:
.RS
.PD 0
.TP
+.B \-n
+Suppresses the normal change of directory when removing directories
+from the stack, so that only the stack is manipulated.
+.TP
\fB+\fP\fIn\fP
Removes the \fIn\fPth entry counting from the left of the list
shown by
@@ -7291,10 +7729,6 @@ removes the last directory,
.if n ``popd -1''
.if t \f(CWpopd -1\fP
the next to last.
-.TP
-.B \-n
-Suppresses the normal change of directory when removing directories
-from the stack, so that only the stack is manipulated.
.PD
.PP
If the
@@ -7333,10 +7767,10 @@ extra format specifications behave as if a zero value or null string, as
appropriate, had been supplied. The return value is zero on success,
non-zero on failure.
.TP
-\fBpushd\fP [\fB\-n\fP] [\fIdir\fP]
+\fBpushd\fP [\fB\-n\fP] [+\fIn\fP] [\-\fIn\fP]
.PD 0
.TP
-\fBpushd\fP [\fB\-n\fP] [+\fIn\fP] [\-\fIn\fP]
+\fBpushd\fP [\fB\-n\fP] [\fIdir\fP]
.PD
Adds a directory to the top of the directory stack, or rotates
the stack, making the new top of the stack the current working
@@ -7346,6 +7780,10 @@ Arguments, if supplied, have the following meanings:
.RS
.PD 0
.TP
+.B \-n
+Suppresses the normal change of directory when adding directories
+to the stack, so that only the stack is manipulated.
+.TP
\fB+\fP\fIn\fP
Rotates the stack so that the \fIn\fPth directory
(counting from the left of the list shown by
@@ -7359,10 +7797,6 @@ Rotates the stack so that the \fIn\fPth directory
.BR dirs ,
starting with zero) is at the top.
.TP
-.B \-n
-Suppresses the normal change of directory when adding directories
-to the stack, so that only the stack is manipulated.
-.TP
.I dir
Adds
.I dir
@@ -7403,7 +7837,7 @@ The return status is 0 unless an error occurs while
reading the name of the current directory or an
invalid option is supplied.
.TP
-\fBread\fP [\fB\-ers\fP] [\fB\-u\fP \fIfd\fP] [\fB\-t\fP \fItimeout\fP] [\fB\-a\fP \fIaname\fP] [\fB\-p\fP \fIprompt\fP] [\fB\-n\fP \fInchars\fP] [\fB\-d\fP \fIdelim\fP] [\fIname\fP ...]
+\fBread\fP [\fB\-ers\fP] [\fB\-a\fP \fIaname\fP] [\fB\-d\fP \fIdelim\fP] [\fB\-\fP \fItext\fP] [\fB\-n\fP \fInchars\fP] [\fB\-p\fP \fIprompt\fP] [\fB\-t\fP \fItimeout\fP] [\fB\-u\fP \fIfd\fP] [\fIname\fP ...]
One line is read from the standard input, or from the file descriptor
\fIfd\fP supplied as an argument to the \fB\-u\fP option, and the first word
is assigned to the first
@@ -7446,6 +7880,14 @@ is coming from a terminal,
.SM
.B READLINE
above) is used to obtain the line.
+Readline uses the current (or default, if line editing was not previously
+active) editing settings.
+.TP
+.B \-i \fItext\fP
+If
+.B readline
+is being used to read the line, \fItext\fP is placed into the editing
+buffer before editing begins.
.TP
.B \-n \fInchars\fP
\fBread\fP returns after reading \fInchars\fP characters rather than
@@ -7469,8 +7911,14 @@ not echoed.
.B \-t \fItimeout\fP
Cause \fBread\fP to time out and return failure if a complete line of
input is not read within \fItimeout\fP seconds.
-This option has no effect if \fBread\fP is not reading input from the
-terminal or a pipe.
+\fItimeout\fP may be a decimal number with a fractional portion following
+the decimal point.
+This option is only effective if \fBread\fP is reading input from a
+terminal, pipe, or other special file; it has no effect when reading
+from regular files.
+If \fItimeout\fP is 0, \fBread\fP returns success if input is available on
+the specified file descriptor, failure otherwise.
+The exit status is greater than 128 if the timeout is exceeded.
.TP
.B \-u \fIfd\fP
Read input from file descriptor \fIfd\fP.
@@ -7482,11 +7930,11 @@ are supplied, the line read is assigned to the variable
.SM
.BR REPLY .
The return code is zero, unless end-of-file is encountered, \fBread\fP
-times out, or an invalid file descriptor is supplied as the argument to
-\fB\-u\fP.
+times out (in which case the return code is greater than 128), or an
+invalid file descriptor is supplied as the argument to \fB\-u\fP.
.RE
.TP
-\fBreadonly\fP [\fB\-apf\fP] [\fIname\fP[=\fIword\fP] ...]
+\fBreadonly\fP [\fB\-aApf\fP] [\fIname\fP[=\fIword\fP] ...]
.PD
The given
\fInames\fP are marked readonly; the values of these
@@ -7499,7 +7947,9 @@ option is supplied, the functions corresponding to the
marked.
The
.B \-a
-option restricts the variables to arrays.
+option restricts the variables to indexed arrays; the
+.B \-A
+option restricts the variables to associative arrays.
If no
.I name
arguments are given, or if the
@@ -7539,7 +7989,11 @@ the return status is false.
Any command associated with the \fBRETURN\fP trap is executed
before execution resumes after the function or script.
.TP
-\fBset\fP [\fB\-\-abefhkmnptuvxBCHP\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...]
+\fBset\fP [\fB\-\-abefhkmnptuvxBCEHPT\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...]
+.PD 0
+.TP
+\fBset\fP [\fB+abefhkmnptuvxBCEHPT\fP] [\fB+o\fP \fIoption\fP] [\fIarg\fP ...]
+.PD
Without options, the name and value of each shell variable are displayed
in a format that can be reused as input
for setting or resetting the currently-set variables.
@@ -7547,7 +8001,7 @@ Read-only variables cannot be reset.
In \fIposix mode\fP, only shell variables are listed.
The output is sorted according to the current locale.
When options are specified, they set or unset shell attributes.
-Any arguments remaining after the options are processed are treated
+Any arguments remaining after option processing are treated
as values for the positional parameters and are assigned, in order, to
.BR $1 ,
.BR $2 ,
@@ -7578,14 +8032,19 @@ or
.B until
keyword,
part of the test in an
-.I if
-statement, part of a
+.B if
+statement, part of a command executed in a
.B &&
or
.B \(bv\(bv
-list, or if the command's return value is
+list,
+any command in a pipeline but the last,
+or if the command's return value is
being inverted via
.BR ! .
+Failing simple commands that are part of shell functions or command lists
+enclosed in braces or parentheses satisfying the above conditions do not
+cause the shell to exit.
A trap on \fBERR\fP, if set, is executed before the shell exits.
.TP 8
.B \-f
@@ -7633,6 +8092,7 @@ by default when the shell is interactive, unless the shell is started
with the
.B \-\-noediting
option.
+This also affects the editing interface used for \fBread \-e\fP.
.TP 8
.B errtrace
Same as
@@ -7688,6 +8148,7 @@ Same as
.B noglob
Same as
.BR \-f .
+.TP 8
.B nolog
Currently ignored.
.TP 8
@@ -7729,6 +8190,7 @@ Same as
.TP 8
.B vi
Use a vi-style command line editing interface.
+This also affects the editing interface used for \fBread \-e\fP.
.TP 8
.B xtrace
Same as
@@ -7759,8 +8221,11 @@ and
files are not processed, shell functions are not inherited from the
environment, and the
.SM
-.B SHELLOPTS
-variable, if it appears in the environment, is ignored.
+.BR SHELLOPTS ,
+.BR CDPATH ,
+and
+.B GLOBIGNORE
+variables, if they appear in the environment, are ignored.
If the shell is started with the effective user (group) id not equal to the
real user (group) id, and the \fB\-p\fP option is not supplied, these actions
are taken and the effective user id is set to the real user id.
@@ -7939,6 +8404,11 @@ The list of \fBshopt\fP options is:
.if n .sp 1v
.PD 0
.TP 8
+.B autocd
+If set, a command name that is the name of a directory is executed as if
+it were the argument to the \fBcd\fP command.
+This option is only used by interactive shells.
+.TP 8
.B cdable_vars
If set, an argument to the
.B cd
@@ -7961,6 +8431,13 @@ If set, \fBbash\fP checks that a command found in the hash
table exists before trying to execute it. If a hashed command no
longer exists, a normal path search is performed.
.TP 8
+.B checkjobs
+If set, \fBbash\fP lists the status of any stopped and running jobs before
+exiting an interactive shell. If any jobs are running, this causes
+the exit to be deferred until a second exit is attempted without an
+intervening command (see \fBJOB CONTROL\fP above). The shell always
+postpones exiting if any jobs are stopped.
+.TP 8
.B checkwinsize
If set, \fBbash\fP checks the window size after each command
and, if necessary, updates the values of
@@ -7983,6 +8460,12 @@ If set,
changes its behavior to that of version 3.1 with respect to quoted
arguments to the conditional command's =~ operator.
.TP 8
+.B dirspell
+If set,
+.B bash
+attempts spelling correction on directory names during word completion
+if the directory name initially supplied does not exist.
+.TP 8
.B dotglob
If set,
.B bash
@@ -8060,6 +8543,12 @@ See
above for a description of \fBFIGNORE\fP.
This option is enabled by default.
.TP 8
+.B globstar
+If set, the pattern \fB**\fP used in a filename expansion context will
+match a files and zero or more directories and subdirectories.
+If the pattern is followed by a \fB/\fP, only directories and
+subdirectories match.
+.TP 8
.B gnu_errfmt
If set, shell error messages are written in the standard GNU error
message format.
@@ -8204,11 +8693,10 @@ by default.
Suspend the execution of this shell until it receives a
.SM
.B SIGCONT
-signal. The
+signal. A login shell cannot be suspended; the
.B \-f
-option says not to complain if this is
-a login shell; just suspend anyway. The return status is 0 unless
-the shell is a login shell and
+option can be used to override this and force the suspension.
+The return status is 0 unless the shell is a login shell and
.B \-f
is not supplied, or if job control is not enabled.
.TP
@@ -8229,6 +8717,7 @@ an argument of \fB\-\-\fP as signifying the end of options.
.if n .sp 1
Expressions may be combined using the following operators, listed
in decreasing order of precedence.
+The evaluation depends on the number of arguments; see below.
.RS
.PD 0
.TP
@@ -8286,14 +8775,14 @@ under
.BR "CONDITIONAL EXPRESSIONS" ,
the result of the expression is the result of the binary test using
the first and third arguments as operands.
+The \fB\-a\fP and \fB\-o\fP operators are considered binary operators
+when there are three arguments.
If the first argument is \fB!\fP, the value is the negation of
the two-argument test using the second and third arguments.
If the first argument is exactly \fB(\fP and the third argument is
exactly \fB)\fP, the result is the one-argument test of the second
argument.
Otherwise, the expression is false.
-The \fB\-a\fP and \fB\-o\fP operators are considered binary operators
-in this case.
.TP
4 arguments
If the first argument is \fB!\fP, the result is the negation of
@@ -8393,7 +8882,7 @@ or
keyword,
part of the test in an
.I if
-statement, part of a
+statement, part of a command executed in a
.B &&
or
.B \(bv\(bv
@@ -8492,15 +8981,16 @@ The
.B \-f
option suppresses shell function lookup, as with the \fBcommand\fP builtin.
.B type
-returns true if any of the arguments are found, false if
-none are found.
+returns true if all of the arguments are found, false if
+any are not found.
.TP
-\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]]
+\fBulimit\fP [\fB\-HSTabcdefilmnpqrstuvx\fP [\fIlimit\fP]]
Provides control over the resources available to the shell and to
processes started by it, on systems that allow such control.
The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
-set for the given resource. A hard limit cannot be increased once it
-is set; a soft limit may be increased up to the value of the hard limit.
+set for the given resource.
+A hard limit cannot be increased by a non-root user once it is set;
+a soft limit may be increased up to the value of the hard limit.
If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard
limits are set.
The value of
@@ -8525,6 +9015,9 @@ Other options are interpreted as follows:
.B \-a
All current limits are reported
.TP
+.B \-b
+The maximum socket buffer size
+.TP
.B \-c
The maximum size of core files created
.TP
@@ -8573,6 +9066,9 @@ The maximum amount of virtual memory available to the shell
.TP
.B \-x
The maximum number of file locks
+.TP
+.B \-T
+The maximum number of threads
.PD
.PP
If
@@ -8588,7 +9084,9 @@ which is in seconds,
.BR \-p ,
which is in units of 512-byte blocks,
and
-.B \-n
+.BR \-T ,
+.BR \-b ,
+.BR \-n ,
and
.BR \-u ,
which are unscaled values.
@@ -8881,12 +9379,8 @@ It suffices to place the sequence of commands between
parentheses to force it into a subshell, which may be stopped as
a unit.
.PP
-Commands inside of \fB$(\fP...\fB)\fP command substitution are not
-parsed until substitution is attempted. This will delay error
-reporting until some time after the command is entered. For example,
-unmatched parentheses, even inside shell comments, will result in
-error messages while the construct is being read.
-.PP
Array variables may not (yet) be exported.
+.PP
+There may be only one active coprocess at a time.
.zZ
.zY
diff --git a/doc/bashbug.1 b/doc/bashbug.1
index 971e4c4c..962cb9cb 100644
--- a/doc/bashbug.1
+++ b/doc/bashbug.1
@@ -1,8 +1,17 @@
-.TH BASHBUG 1 "1998 July 30" GNU
+.\"
+.\" MAN PAGE COMMENTS to
+.\"
+.\" Chet Ramey
+.\" Case Western Reserve University
+.\" chet@po.cwru.edu
+.\"
+.\" Last Change: Tue Apr 3 15:46:30 EDT 2007
+.\"
+.TH BASHBUG 1 "1998 July 30" "GNU Bash-4.0"
.SH NAME
bashbug \- report a bug in bash
.SH SYNOPSIS
-\fBbashbug\fP [\fIaddress\fP]
+\fBbashbug\fP [\fI--version\fP] [\fI--help\fP] [\fIemail-address\fP]
.SH DESCRIPTION
.B bashbug
is a shell script to help the user compose and mail bug reports
@@ -15,7 +24,7 @@ on a temporary copy of the bug report format outline. The user must
fill in the appropriate fields and exit the editor.
.B bashbug
then mails the completed report to \fIbug-bash@gnu.org\fP, or
-\fIaddress\fP. If the report cannot be mailed, it is saved in the
+\fIemail-address\fP. If the report cannot be mailed, it is saved in the
file \fIdead.bashbug\fP in the invoking user's home directory.
.PP
The bug report format outline consists of several sections. The first
@@ -39,3 +48,17 @@ defaults to
.TP
.B HOME
Directory in which the failed bug report is saved if the mail fails.
+.TP
+.B TMPDIR
+Directory in which to create temporary files and directories.
+.SH "SEE ALSO"
+.TP
+\fIbash\fP(1)
+.SH AUTHORS
+Brian Fox, Free Software Foundation
+.br
+bfox@gnu.org
+.PP
+Chet Ramey, Case Western Reserve University
+.br
+chet@po.cwru.edu
diff --git a/doc/bashref.info b/doc/bashref.info
index 3b74eb63..58fd3102 100644
--- a/doc/bashref.info
+++ b/doc/bashref.info
@@ -1,13 +1,13 @@
-This is bashref.info, produced by makeinfo version 4.7 from
+This is bashref.info, produced by makeinfo version 4.11 from
/Users/chet/src/bash/src/doc/bashref.texi.
- This text is a brief description of the features that are present in
-the Bash shell (version 3.2, 28 September 2006).
+This text is a brief description of the features that are present in
+the Bash shell (version 4.0, 28 October 2008).
- This is Edition 3.2, last updated 28 September 2006, of `The GNU
-Bash Reference Manual', for `Bash', Version 3.2.
+ This is Edition 4.0, last updated 28 October 2008, of `The GNU Bash
+Reference Manual', for `Bash', Version 4.0.
- Copyright (C) 1988-2005 Free Software Foundation, Inc.
+ Copyright (C) 1988-2008 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
@@ -17,13 +17,14 @@ preserved on all copies.
document under the terms of the GNU Free Documentation License,
Version 1.2 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)
+ 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."
+ "GNU Free Documentation License".
+
+ (a) The FSF's Back-Cover Text is: You are free to copy and modify
+ this GNU manual. Buying copies from GNU Press supports the FSF in
+ developing GNU and promoting software freedom."
- (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."
INFO-DIR-SECTION Basics
START-INFO-DIR-ENTRY
@@ -37,10 +38,10 @@ Bash Features
*************
This text is a brief description of the features that are present in
-the Bash shell (version 3.2, 28 September 2006).
+the Bash shell (version 4.0, 28 October 2008).
- This is Edition 3.2, last updated 28 September 2006, of `The GNU
-Bash Reference Manual', for `Bash', Version 3.2.
+ This is Edition 4.0, last updated 28 October 2008, of `The GNU Bash
+Reference Manual', for `Bash', Version 4.0.
Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -64,22 +65,16 @@ 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.

File: bashref.info, Node: Introduction, Next: Definitions, Prev: Top, Up: Top
@@ -130,7 +125,7 @@ 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 GNU utilities. The programming language
-features allow these utilitites to be combined. Files containing
+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
`/bin', allowing users or groups to establish custom environments to
@@ -189,8 +184,9 @@ These definitions are used throughout the remainder of this manual.
rather than by an executable program somewhere in the file system.
`control operator'
- A `word' that performs a control function. It is a `newline' or
- one of the following: `||', `&&', `&', `;', `;;', `|', `(', or `)'.
+ A `token' that performs a control function. It is a `newline' or
+ one of the following: `||', `&&', `&', `;', `;;', `|', `|&', `(',
+ or `)'.
`exit status'
The value returned by a command to its caller. The value is
@@ -225,14 +221,15 @@ These definitions are used throughout the remainder of this manual.
`operator'
A `control operator' or a `redirection operator'. *Note
- Redirections::, for a list of redirection operators.
+ Redirections::, for a list of redirection operators. Operators
+ contain at least one unquoted `metacharacter'.
`process group'
A collection of related processes each having the same process
group ID.
`process group ID'
- A unique identifer that represents a `process group' during its
+ A unique identifier that represents a `process group' during its
lifetime.
`reserved word'
@@ -256,7 +253,8 @@ These definitions are used throughout the remainder of this manual.
It is either a `word' or an `operator'.
`word'
- A `token' that is not an `operator'.
+ A sequence of characters treated as a unit by the shell. Words
+ may not include unquoted `metacharacters'.

File: bashref.info, Node: Basic Shell Features, Next: Shell Builtin Commands, Prev: Definitions, Up: Top
@@ -327,7 +325,7 @@ reads and executes a command. Basically, the shell does the following:
Invoking Bash::), or from the user's terminal.
2. Breaks the input into words and operators, obeying the quoting
- rules described in *Note Quoting::. These tokens are separated by
+ rules described in *note Quoting::. These tokens are separated by
`metacharacters'. Alias expansion is performed by this step
(*note Aliases::).
@@ -508,9 +506,9 @@ File: bashref.info, Node: Comments, Prev: Quoting, Up: Shell Syntax
In a non-interactive shell, or an interactive shell in which the
`interactive_comments' option to the `shopt' builtin is enabled (*note
-Bash Builtins::), a word beginning with `#' causes that word and all
-remaining characters on that line to be ignored. An interactive shell
-without the `interactive_comments' option enabled does not allow
+The Shopt Builtin::), a word beginning with `#' causes that word and
+all remaining characters on that line to be ignored. An interactive
+shell without the `interactive_comments' option enabled does not allow
comments. The `interactive_comments' option is on by default in
interactive shells. *Note Interactive Shells::, for a description of
what makes a shell interactive.
@@ -536,6 +534,7 @@ construct, or in some other grouping.
commands.
* Lists:: How to execute commands sequentially.
* Compound Commands:: Shell commands for control flow.
+* Coprocesses:: Two-way communication between commands.

File: bashref.info, Node: Simple Commands, Next: Pipelines, Up: Shell Commands
@@ -559,14 +558,21 @@ File: bashref.info, Node: Pipelines, Next: Lists, Prev: Simple Commands, Up:
3.2.2 Pipelines
---------------
-A `pipeline' is a sequence of simple commands separated by `|'.
+A `pipeline' is a sequence of simple commands separated by one of the
+control operators `|' or `|&'.
The format for a pipeline is
- [`time' [`-p']] [`!'] COMMAND1 [`|' COMMAND2 ...]
+ [`time' [`-p']] [`!'] COMMAND1 [ [`|' or `|&'] COMMAND2 ...]
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.
+previous command's output. This connection is performed before any
+redirections specified by the command.
+
+ If `|&' is used, the standard error of COMMAND1 is connected to
+COMMAND2's standard input through the pipe; it is shorthand for `2>&1
+|'. This implicit redirection of the standard error is performed after
+any redirections specified by the command.
The reserved word `time' causes timing statistics to be printed for
the pipeline once it finishes. The statistics currently consist of
@@ -621,8 +627,11 @@ redirected from `/dev/null'.
waits for each command to terminate in turn. The return status is the
exit status of the last command executed.
- The control operators `&&' and `||' denote AND lists and OR lists,
-respectively. An AND list has the form
+ AND and OR lists are sequences of one or more pipelines separated by
+the control operators `&&' and `||', respectively. AND and OR lists
+are executed with left associativity.
+
+ An AND list has the form
COMMAND1 && COMMAND2
COMMAND2 is executed if, and only if, COMMAND1 returns an exit status
@@ -638,7 +647,7 @@ status.
command executed in the list.

-File: bashref.info, Node: Compound Commands, Prev: Lists, Up: Shell Commands
+File: bashref.info, Node: Compound Commands, Next: Coprocesses, Prev: Lists, Up: Shell Commands
3.2.4 Compound Commands
-----------------------
@@ -751,21 +760,23 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
`case' will selectively execute the COMMAND-LIST corresponding to
the first PATTERN that matches WORD. If the shell option
- `nocasematch' (see the description of `shopt' in *Note Bash
- Builtins::) is enabled, the match is performed without regard to
+ `nocasematch' (see the description of `shopt' in *note The Shopt
+ Builtin::) is enabled, the match is performed without regard to
the case of alphabetic characters. The `|' is used to separate
multiple patterns, and the `)' operator terminates a pattern list.
A list of patterns and an associated command-list is known as a
- CLAUSE. Each clause must be terminated with `;;'. The WORD
- undergoes tilde expansion, parameter expansion, command
+ CLAUSE.
+
+ Each clause must be terminated with `;;', `,&', or `;;&'. The
+ WORD undergoes tilde expansion, parameter expansion, command
substitution, arithmetic expansion, and quote removal before
matching is attempted. Each PATTERN undergoes tilde expansion,
parameter expansion, command substitution, and arithmetic
expansion.
There may be an arbitrary number of `case' clauses, each terminated
- by a `;;'. The first pattern that matches determines the
- command-list that is executed.
+ by a `;;', `;&', or `;;&'. The first pattern that matches
+ determines the command-list that is executed.
Here is an example using `case' in a script that could be used to
describe one interesting feature of an animal:
@@ -780,6 +791,13 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
esac
echo " legs."
+ If the `;;' operator is used, no subsequent matches are attempted
+ after the first pattern match. Using `;&' in place of `;;'
+ causes execution to continue with the COMMAND-LIST associated with
+ the next clause, if any. Using `;;&' in place of `;;' causes the
+ shell to test the patterns in the next clause, if any, and execute
+ any associated COMMAND-LIST on a successful match.
+
The return status is zero if no PATTERN is matched. Otherwise, the
return status is the exit status of the COMMAND-LIST executed.
@@ -793,7 +811,7 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
items. The set of expanded words is printed on the standard error
output stream, each preceded by a number. If the `in WORDS' is
omitted, the positional parameters are printed, as if `in "$@"'
- had been specifed. The `PS3' prompt is then displayed and a line
+ had been specified. The `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 words, then the value of
NAME is set to that word. If the line is empty, the words and
@@ -829,7 +847,7 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
Return a status of 0 or 1 depending on the evaluation of the
conditional expression EXPRESSION. Expressions are composed of
- the primaries described below in *Note Bash Conditional
+ the primaries described below in *note Bash Conditional
Expressions::. Word splitting and filename expansion are not
performed on the words between the `[[' and `]]'; tilde expansion,
parameter and variable expansion, arithmetic expansion, command
@@ -839,13 +857,13 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
When the `==' and `!=' operators are used, the string to the right
of the operator is considered a pattern and matched according to
- the rules described below in *Note Pattern Matching::. If the
+ the rules described below in *note Pattern Matching::. If the
shell option `nocasematch' (see the description of `shopt' in
- *Note Bash Builtins::) 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, and 1 otherwise. Any part of the pattern may be quoted
- to force it to be matched as a string.
+ *note 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, and 1 otherwise. Any part of the pattern may
+ be quoted to force it to be matched as a string.
An additional binary operator, `=~', is available, with the same
precedence as `==' and `!='. When it is used, the string to the
@@ -854,14 +872,16 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
the string matches the pattern, and 1 otherwise. If the regular
expression is syntactically incorrect, the conditional
expression's return value is 2. If the shell option `nocasematch'
- (see the description of `shopt' in *Note Bash Builtins::) is
+ (see the description of `shopt' in *note The Shopt Builtin::) is
enabled, the match is performed without regard to the case of
- alphabetic characters. Substrings matched by parenthesized
- subexpressions within the regular expression are saved in the
- array variable `BASH_REMATCH'. The element of `BASH_REMATCH' with
- index 0 is the portion of the string matching the entire regular
- expression. The element of `BASH_REMATCH' with index N is the
- portion of the string matching the Nth parenthesized subexpression.
+ alphabetic characters. Any part of the pattern may be quoted to
+ force it to be matched as a string. Substrings matched by
+ parenthesized subexpressions within the regular expression are
+ saved in the array variable `BASH_REMATCH'. The element of
+ `BASH_REMATCH' with index 0 is the portion of the string matching
+ the entire regular expression. The element of `BASH_REMATCH' with
+ index N is the portion of the string matching the Nth
+ parenthesized subexpression.
Expressions may be combined using the following operators, listed
in decreasing order of precedence:
@@ -913,14 +933,48 @@ the list may be redirected to a single stream.
In addition to the creation of a subshell, there is a subtle
difference between these two constructs due to historical reasons. The
braces are `reserved words', so they must be separated from the LIST by
-`blank's. The parentheses are `operators', and are recognized as
-separate tokens by the shell even if they are not separated from the
-LIST by whitespace.
+`blank's or other shell metacharacters. The parentheses are
+`operators', and are recognized as separate tokens by the shell even if
+they are not separated from the LIST by whitespace.
The exit status of both of these constructs is the exit status of
LIST.

+File: bashref.info, Node: Coprocesses, Prev: Compound Commands, Up: Shell Commands
+
+3.2.5 Coprocesses
+-----------------
+
+A `coprocess' is a shell command preceded by the `coproc' reserved word.
+A coprocess is executed asynchronously in a subshell, as if the command
+had been terminated with the `&' control operator, with a two-way pipe
+established between the executing shell and the coprocess.
+
+ The format for a coprocess is:
+ `coproc' [NAME] COMMAND [REDIRECTIONS]
+
+This creates a coprocess named NAME. If NAME is not supplied, the
+default name is COPROC.
+
+ When the coproc is executed, the shell creates an array variable
+(*note Arrays::) named NAME in the context of the executing shell. The
+standard output of COMMAND is connected via a pipe to a file descriptor
+in the executing shell, and that file descriptor is assigned to NAME[0].
+The standard input of COMMAND is connected via a pipe to a file
+descriptor in the executing shell, and that file descriptor is assigned
+to NAME[1]. This pipe is established before any redirections specified
+by the command (*note Redirections::). The file descriptors can be
+utilized as arguments to shell commands and redirections using standard
+word expansions.
+
+ The process id of the shell spawned to execute the coprocess is
+available as the value of the variable NAME_PID. The `wait' builtin
+command may be used to wait for the coprocess to terminate.
+
+ The return status of a coprocess is the exit status of COMMAND.
+
+
File: bashref.info, Node: Shell Functions, Next: Shell Parameters, Prev: Shell Commands, Up: Basic Shell Features
3.3 Shell Functions
@@ -958,8 +1012,9 @@ last command executed in the body.
braces that surround the body of the function must be separated from
the body by `blank's or newlines. This is because the braces are
reserved words and are only recognized as such when they are separated
-by whitespace. Also, when using the braces, the LIST must be
-terminated by a semicolon, a `&', or a newline.
+from the command list by whitespace or another shell metacharacter.
+Also, when using the braces, the LIST must be terminated by a semicolon,
+a `&', or a newline.
When a function is executed, the arguments to the function become
the positional parameters during its execution (*note Positional
@@ -1018,7 +1073,7 @@ File: bashref.info, Node: Shell Parameters, Next: Shell Expansions, Prev: She
number, or one of the special characters listed below. A VARIABLE is a
parameter denoted by a `name'. A variable has a VALUE and zero or more
ATTRIBUTES. Attributes are assigned using the `declare' builtin command
-(see the description of the `declare' builtin in *Note Bash Builtins::).
+(see the description of the `declare' builtin in *note Bash Builtins::).
A parameter is set if it has been assigned a value. The null string
is a valid value. Once a variable is set, it may be unset only by using
@@ -1046,8 +1101,10 @@ variable's current value, which is also evaluated. When `+=' is
applied to an array variable using compound assignment (*note
Arrays::), the variable's value is not unset (as it is when using `='),
and new values are appended to the array beginning at one greater than
-the array's maximum index. When applied to a string-valued variable,
-VALUE is expanded and appended to the variable's value.
+the array's maximum index (for indexed arrays), or added as additional
+key-value pairs in an associative array. When applied to a
+string-valued variable, VALUE is expanded and appended to the
+variable's value.

File: bashref.info, Node: Positional Parameters, Next: Special Parameters, Up: Shell Parameters
@@ -1201,7 +1258,7 @@ Brace expansion is a mechanism by which arbitrary strings may be
generated. This mechanism is similar to FILENAME EXPANSION (*note
Filename Expansion::), but the file names generated need not exist.
Patterns to be brace expanded take the form of an optional PREAMBLE,
-followed by either a series of comma-separated strings or a sequnce
+followed by either a series of comma-separated strings or a seqeunce
expression between a pair of braces, followed by an optional POSTSCRIPT.
The preamble is prefixed to each string contained within the braces, and
the postscript is then appended to each resulting string, expanding left
@@ -1212,12 +1269,18 @@ are not sorted; left to right order is preserved. For example,
bash$ echo a{d,c,b}e
ade ace abe
- A sequence expression takes the form `{X..Y}', where X and Y are
-either integers or single characters. When integers are supplied, the
-expression expands to each number between X and Y, inclusive. When
-characters are supplied, the expression expands to each character
-lexicographically between X and Y, inclusive. Note that both X and Y
-must be of the same type.
+ A sequence expression takes the form `{X..Y[INCR]}', where X and Y
+are either integers or single characters, and INCR, an optional
+increment, is an integer. When integers are supplied, the expression
+expands to each number between X and Y, inclusive. Supplied integers
+may be prefixed with `0' to force each term to have the same width.
+When either X or 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 X and Y, inclusive. Note
+that both X and 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 in the result. It
@@ -1380,19 +1443,26 @@ if the colon is omitted, the operator tests only for existence.
If OFFSET evaluates to a number less than zero, the value is used
as an offset from the end of the value of PARAMETER. If PARAMETER
is `@', the result is LENGTH positional parameters beginning at
- OFFSET. If PARAMETER is an array name indexed by `@' or `*', the
- result is the LENGTH members of the array beginning with
- `${PARAMETER[OFFSET]}'. A negative 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 `:-' expansion.
+ OFFSET. If PARAMETER is an indexed array name subscripted by `@'
+ or `*', the result is the LENGTH members of the array beginning
+ with `${PARAMETER[OFFSET]}'. A negative OFFSET is taken relative
+ to one greater than the maximum index of the specified array.
+ Substring expansion applied to an associative array produces
+ undefined results.
+
+ Note that a negative offset must be separated from the colon by at
+ least one space to avoid being confused with the `:-' expansion.
Substring indexing is zero-based unless the positional parameters
- are used, in which case the indexing starts at 1.
+ are used, in which case the indexing starts at 1 by default. If
+ OFFSET is 0, and the positional parameters are used, `$@' is
+ prefixed to the list.
`${!PREFIX*}'
`${!PREFIX@}'
Expands to the names of variables whose names begin with PREFIX,
separated by the first character of the `IFS' special variable.
+ When `@' is used and the expansion appears within double quotes,
+ each variable name expands to a separate word.
`${!NAME[@]}'
`${!NAME[*]}'
@@ -1454,6 +1524,25 @@ if the colon is omitted, the operator tests only for existence.
member of the array in turn, and the expansion is the resultant
list.
+`${PARAMETER^PATTERN}'
+`${PARAMETER^^PATTERN}'
+`${PARAMETER,PATTERN}'
+`${PARAMETER,,PATTERN}'
+ This expansion modifies the case of alphabetic characters in
+ PARAMETER. The PATTERN is expanded to produce a pattern just as in
+ pathname expansion. The `^' operator converts lowercase letters
+ matching PATTERN to uppercase; the `,' operator converts matching
+ uppercase letters to lowercase. The `^^' and `,,' expansions
+ convert each matched character in the expanded value; the `^' and
+ `,' expansions match and convert only the first character. If
+ PATTERN is omitted, it is treated like a `?', which matches every
+ character. If PARAMETER is `@' or `*', the case modification
+ operation is applied to each positional parameter in turn, and the
+ expansion is the resultant list. If PARAMETER is an array
+ variable subscripted with `@' or `*', the case modification
+ operation is applied to each member of the array in turn, and the
+ expansion is the resultant list.
+

File: bashref.info, Node: Command Substitution, Next: Arithmetic Expansion, Prev: Shell Parameter Expansion, Up: Shell Expansions
@@ -1546,15 +1635,17 @@ quotes for word splitting.
The shell treats each character of `$IFS' as a delimiter, and splits
the results of the other expansions into words on these characters. If
`IFS' is unset, or its value is exactly `<space><tab><newline>', the
-default, then any sequence of `IFS' characters serves to delimit words.
-If `IFS' has a value other than the default, then sequences of the
-whitespace characters `space' and `tab' are ignored at the beginning
-and end of the word, as long as the whitespace character is in the
-value of `IFS' (an `IFS' whitespace character). Any character in `IFS'
-that is not `IFS' whitespace, along with any adjacent `IFS' whitespace
-characters, delimits a field. A sequence of `IFS' whitespace
-characters is also treated as a delimiter. If the value of `IFS' is
-null, no word splitting occurs.
+default, then sequences of ` <space>', `<tab>', and `<newline>' at the
+beginning and end of the results of the previous expansions are
+ignored, and any sequence of `IFS' characters not at the beginning or
+end serves to delimit words. If `IFS' has a value other than the
+default, then sequences of the whitespace characters `space' and `tab'
+are ignored at the beginning and end of the word, as long as the
+whitespace character is in the value of `IFS' (an `IFS' whitespace
+character). Any character in `IFS' that is not `IFS' whitespace, along
+with any adjacent `IFS' whitespace characters, delimits a field. A
+sequence of `IFS' whitespace characters is also treated as a delimiter.
+If the value of `IFS' is null, no word splitting occurs.
Explicit null arguments (`""' or `''') are retained. Unquoted
implicit null arguments, resulting from the expansion of parameters
@@ -1591,7 +1682,7 @@ matched explicitly, unless the shell option `dotglob' is set. When
matching a file name, the slash character must always be matched
explicitly. In other cases, the `.' character is not treated specially.
- See the description of `shopt' in *Note Bash Builtins::, for a
+ See the description of `shopt' in *note The Shopt Builtin::, for a
description of the `nocaseglob', `nullglob', `failglob', and `dotglob'
options.
@@ -1620,7 +1711,12 @@ characters must be quoted if they are to be matched literally.
The special pattern characters have the following meanings:
`*'
- Matches any string, including the null string.
+ Matches any string, including the null string. When the
+ `globstar' shell option is enabled, and `*' is used in a filename
+ expansion context, two adjacent `*'s used as a single pattern will
+ match all files and zero or more directories and subdirectories.
+ If followed by a `/', two adjacent `*'s will match only
+ directories and subdirectories.
`?'
Matches any single character.
@@ -1805,9 +1901,9 @@ specified. If the file does not exist it is created.
3.6.4 Redirecting Standard Output and Standard Error
----------------------------------------------------
-Bash 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 WORD with this construct.
+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 WORD.
There are two formats for redirecting standard output and standard
error:
@@ -1818,7 +1914,19 @@ error:
equivalent to
>WORD 2>&1
-3.6.5 Here Documents
+3.6.5 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 WORD.
+
+ The format for appending standard output and standard error is:
+ &>>WORD
+ This is semantically equivalent to
+ >>WORD 2>&1
+
+3.6.6 Here Documents
--------------------
This type of redirection instructs the shell to read input from the
@@ -1845,7 +1953,7 @@ characters are stripped from input lines and the line containing
DELIMITER. This allows here-documents within shell scripts to be
indented in a natural fashion.
-3.6.6 Here Strings
+3.6.7 Here Strings
------------------
A variant of here documents, the format is:
@@ -1854,7 +1962,7 @@ A variant of here documents, the format is:
The WORD is expanded and supplied to the command on its standard
input.
-3.6.7 Duplicating File Descriptors
+3.6.8 Duplicating File Descriptors
----------------------------------
The redirection operator
@@ -1875,7 +1983,7 @@ redirection error occurs. As a special case, if N is omitted, and WORD
does not expand to one or more digits, the standard output and standard
error are redirected as described previously.
-3.6.8 Moving File Descriptors
+3.6.9 Moving File Descriptors
-----------------------------
The redirection operator
@@ -1889,8 +1997,8 @@ closed after being duplicated to N.
moves the file descriptor DIGIT to file descriptor N, or the
standard output (file descriptor 1) if N is not specified.
-3.6.9 Opening File Descriptors for Reading and Writing
-------------------------------------------------------
+3.6.10 Opening File Descriptors for Reading and Writing
+-------------------------------------------------------
The redirection operator
[N]<>WORD
@@ -1973,7 +2081,7 @@ taken.
1. If the command name contains no slashes, the shell attempts to
locate it. If there exists a shell function by that name, that
- function is invoked as described in *Note Shell Functions::.
+ function is invoked as described in *note Shell Functions::.
2. If the name does not match a function, the shell searches for it
in the list of shell builtins. If a match is found, that builtin
@@ -1984,10 +2092,15 @@ taken.
directory containing an executable file by that name. Bash uses a
hash table to remember the full pathnames of executable files to
avoid multiple `PATH' searches (see the description of `hash' in
- *Note Bourne Shell Builtins::). A full search of the directories
+ *note Bourne Shell Builtins::). A full search of the directories
in `$PATH' is performed only if the command is not found in the
- hash table. If the search is unsuccessful, the shell prints an
- error message and returns an exit status of 127.
+ hash table. If the search is unsuccessful, the shell searches for
+ a defined shell function named `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.
4. If the search is successful, or if the command name contains one
or more slashes, the shell executes the named program in a
@@ -1997,7 +2110,7 @@ taken.
5. If this execution fails because the file is not in executable
format, and the file is not a directory, it is assumed to be a
- SHELL SCRIPT and the shell executes it as described in *Note Shell
+ SHELL SCRIPT and the shell executes it as described in *note Shell
Scripts::.
6. If the command was not begun asynchronously, the shell waits for
@@ -2032,7 +2145,7 @@ The shell has an EXECUTION ENVIRONMENT, which consists of the following:
* options enabled at invocation (either by default or with
command-line arguments) or by `set'
- * options enabled by `shopt'
+ * options enabled by `shopt' (*note The Shopt Builtin::)
* shell aliases defined with `alias' (*note Aliases::)
@@ -2101,7 +2214,7 @@ modified in the shell, less any pairs removed by the `unset' and
The environment for any simple command or function may be augmented
temporarily by prefixing it with parameter assignments, as described in
-*Note Shell Parameters::. These assignment statements affect only the
+*note Shell Parameters::. These assignment statements affect only the
environment seen by that command.
If the `-k' option is set (*note The Set Builtin::), then all
@@ -2118,8 +2231,15 @@ File: bashref.info, Node: Exit Status, Next: Signals, Prev: Environment, Up:
3.7.5 Exit Status
-----------------
-For the shell's purposes, a command which exits with a zero exit status
-has succeeded. A non-zero exit status indicates failure. This
+The exit status of an executed command is the value returned by the
+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. This
seemingly counter-intuitive scheme is used so there is one well-defined
way to indicate success and a variety of ways to indicate various
failure modes. When a command terminates on a fatal signal whose
@@ -2171,8 +2291,8 @@ a particular job, it should be removed from the jobs table with the
receive `SIGHUP' using `disown -h'.
If the `huponexit' shell option has been set with `shopt' (*note
-Bash Builtins::), Bash sends a `SIGHUP' to all jobs when an interactive
-login shell exits.
+The Shopt Builtin::), Bash sends a `SIGHUP' to all jobs when an
+interactive login shell exits.
If Bash is waiting for a command to complete and receives a signal
for which a trap has been set, the trap will not be executed until the
@@ -2214,7 +2334,7 @@ if `filename' is an executable shell script. This subshell
reinitializes itself, so that the effect is as if a new shell had been
invoked to interpret the script, with the exception that the locations
of commands remembered by the parent (see the description of `hash' in
-*Note Bourne Shell Builtins::) are retained by the child.
+*note Bourne Shell Builtins::) are retained by the child.
Most versions of Unix make this a part of the operating system's
command execution mechanism. If the first line of a script begins with
@@ -2245,8 +2365,8 @@ File: bashref.info, Node: Shell Builtin Commands, Next: Shell Variables, Prev
* 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.
@@ -2348,11 +2468,11 @@ standard.
exec [-cl] [-a NAME] [COMMAND [ARGUMENTS]]
If COMMAND is supplied, it replaces the shell without creating a
new process. If the `-l' option is supplied, the shell places a
- dash at the beginning of the zeroth arg passed to COMMAND. This
- is what the `login' program does. The `-c' option causes COMMAND
- to be executed with an empty environment. If `-a' is supplied,
- the shell passes NAME as the zeroth argument to COMMAND. If no
- COMMAND is specified, redirections may be used to affect the
+ dash at the beginning of the zeroth argument passed to COMMAND.
+ This is what the `login' program does. The `-c' option causes
+ COMMAND to be executed with an empty environment. If `-a' is
+ supplied, the shell passes NAME as the zeroth argument to COMMAND.
+ If no 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.
@@ -2447,19 +2567,20 @@ standard.
current directory or an invalid option is supplied.
`readonly'
- readonly [-apf] [NAME[=VALUE]] ...
+ readonly [-aApf] [NAME[=VALUE]] ...
Mark each NAME as readonly. The values of these names may not be
changed by subsequent assignment. If the `-f' option is supplied,
each NAME refers to a shell function. The `-a' option means each
- NAME refers to an array variable. If no NAME arguments are given,
- or if the `-p' option is supplied, a list of all readonly names is
- printed. The `-p' option causes output to be displayed in a
- format that may be reused as input. If a variable name is
- followed by =VALUE, the value of the variable is set to VALUE.
- The return status is zero unless an invalid option is supplied,
- one of the NAME arguments is not a valid shell variable or
- function name, or the `-f' option is supplied with a name that is
- not a shell function.
+ NAME refers to an indexed array variable; the `-A' option means
+ each NAME refers to an associative array variable. If no NAME
+ arguments are given, or if the `-p' option is supplied, a list of
+ all readonly names is printed. The `-p' option causes output to
+ be displayed in a format that may be reused as input. If a
+ variable name is followed by =VALUE, the value of the variable is
+ set to VALUE. The return status is zero unless an invalid option
+ is supplied, one of the NAME arguments is not a valid shell
+ variable or function name, or the `-f' option is supplied with a
+ name that is not a shell function.
`return'
return [N]
@@ -2477,10 +2598,10 @@ standard.
`shift'
shift [N]
Shift the positional parameters to the left by N. The positional
- parameters from N+1 ... `$#' are renamed to `$1' ... `$#'-N+1.
- Parameters represented by the numbers `$#' to N+1 are unset. N
- must be a non-negative number less than or equal to `$#'. If N is
- zero or greater than `$#', the positional parameters are not
+ parameters from N+1 ... `$#' are renamed to `$1' ... `$#'-N.
+ Parameters represented by the numbers `$#' to `$#'-N+1 are unset.
+ N must be a non-negative number less than or equal to `$#'. If N
+ is zero or greater than `$#', the positional parameters are not
changed. If N is not supplied, it is assumed to be 1. The return
status is zero unless N is greater than `$#' or less than zero,
non-zero otherwise.
@@ -2489,7 +2610,7 @@ standard.
`['
Evaluate a conditional expression EXPR. Each operator and operand
must be a separate argument. Expressions are composed of the
- primaries described below in *Note Bash Conditional Expressions::.
+ primaries described below in *note Bash Conditional Expressions::.
`test' does not accept any options, nor does it accept and ignore
an argument of `--' as signifying the end of options.
@@ -2497,7 +2618,8 @@ standard.
be a `]'.
Expressions may be combined using the following operators, listed
- in decreasing order of precedence.
+ in decreasing order of precedence. The evaluation depends on the
+ number of arguments; see below.
`! EXPR'
True if EXPR is false.
@@ -2534,13 +2656,14 @@ standard.
If the second argument is one of the binary conditional
operators (*note Bash Conditional Expressions::), the result
of the expression is the result of the binary test using the
- first and third arguments as operands. If the first argument
- is `!', the value is the negation of the two-argument test
- using the second and third arguments. If the first argument
- is exactly `(' and the third argument is exactly `)', the
- result is the one-argument test of the second argument.
- Otherwise, the expression is false. The `-a' and `-o'
- operators are considered binary operators in this case.
+ first and third arguments as operands. The `-a' and `-o'
+ operators are considered binary operators when there are
+ three arguments. If the first argument is `!', the value is
+ the negation of the two-argument test using the second and
+ third arguments. If the first argument is exactly `(' and
+ the third argument is exactly `)', the result is the
+ one-argument test of the second argument. Otherwise, the
+ expression is false.
4 arguments
If the first argument is `!', the result is the negation of
@@ -2578,18 +2701,18 @@ standard.
`for' command, `case' command, `select' command, every arithmetic
`for' command, and before the first command executes in a shell
function. Refer to the description of the `extglob' option to the
- `shopt' builtin (*note Bash Builtins::) for details of its effect
- on the `DEBUG' trap. If a SIGSPEC is `ERR', the command ARG is
- executed whenever a simple command has a non-zero exit status,
+ `shopt' builtin (*note The Shopt Builtin::) for details of its
+ effect on the `DEBUG' trap. If a SIGSPEC is `ERR', the command ARG
+ is executed whenever a simple command has a non-zero exit status,
subject to the following conditions. The `ERR' trap is not
executed if the failed command is part of the command list
immediately following an `until' or `while' keyword, part of the
- test in an `if' statement, part of a `&&' or `||' list, or if the
- command's return status is being inverted using `!'. These are
- the same conditions obeyed by the `errexit' option. If a SIGSPEC
- is `RETURN', the command ARG is executed each time a shell
- function or a script executed with the `.' or `source' builtins
- finishes executing.
+ test in an `if' statement, part of a command executed in a `&&' or
+ `||' list, or if the command's return status is being inverted
+ using `!'. These are the same conditions obeyed by the `errexit'
+ option. If a SIGSPEC is `RETURN', the command ARG is executed
+ each time a shell function or a script executed with the `.' or
+ `source' builtins finishes executing.
Signals ignored upon entry to the shell cannot be trapped or reset.
Trapped signals that are not being ignored are reset to their
@@ -2625,7 +2748,7 @@ standard.
zero unless a NAME is readonly.

-File: bashref.info, Node: Bash Builtins, Next: The Set Builtin, Prev: Bourne Shell Builtins, Up: Shell Builtin Commands
+File: bashref.info, Node: Bash Builtins, Next: Modifying Shell Behavior, Prev: Bourne Shell Builtins, Up: Shell Builtin Commands
4.2 Bash Builtin Commands
=========================
@@ -2641,7 +2764,7 @@ POSIX standard.
of aliases on the standard output in a form that allows them to be
reused as input. If arguments are supplied, an alias is defined
for each NAME whose VALUE is given. If no VALUE is given, the name
- and value of the alias is printed. Aliases are described in *Note
+ and value of the alias is printed. Aliases are described in *note
Aliases::.
`bind'
@@ -2655,11 +2778,12 @@ POSIX standard.
Display current Readline (*note Command Line Editing::) 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 a Readline initialization file
+ command as it would appear in a Readline initialization file
(*note Readline Init File::), but each binding or command must be
passed as a separate argument; e.g.,
- `"\C-x\C-r":re-read-init-file'. Options, if supplied, have the
- following meanings:
+ `"\C-x\C-r":re-read-init-file'.
+
+ Options, if supplied, have the following meanings:
`-m KEYMAP'
Use KEYMAP as the keymap to be affected by the subsequent
@@ -2710,7 +2834,12 @@ POSIX standard.
`-x KEYSEQ:SHELL-COMMAND'
Cause SHELL-COMMAND to be executed whenever KEYSEQ is entered.
-
+ When SHELL-COMMAND is executed, the shell sets the
+ `READLINE_LINE' variable to the contents of the Readline line
+ buffer and the `READLINE_POINT' variable to the current
+ location of the insertion point. If the executed command
+ changes the value of `READLINE_LINE' or `READLINE_POINT',
+ those new values will be reflected in the editing state.
The return status is zero unless an invalid option is supplied or
an error occurs.
@@ -2760,23 +2889,35 @@ POSIX standard.
non-zero if not.
`declare'
- declare [-afFirtx] [-p] [NAME[=VALUE] ...]
+ declare [-aAfFilrtux] [-p] [NAME[=VALUE] ...]
Declare variables and give them attributes. If no NAMEs are
given, then display the values of variables instead.
The `-p' option will display the attributes and values of each
- NAME. When `-p' is used, additional options are ignored. The
- `-F' option inhibits the display of function definitions; only the
- function name and attributes are printed. If the `extdebug' shell
- option is enabled using `shopt' (*note Bash Builtins::), the
- source file name and line number where the function is defined are
- displayed as well. `-F' implies `-f'. The following options can
- be used to restrict output to variables with the specified
+ NAME. When `-p' is used with NAME arguments, additional options
+ are ignored.
+
+ When `-p' is supplied without NAME arguments, `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 `-p', `declare' will display the
+ attributes and values of all shell variables. The `-f' option
+ will restrict the display to shell functions.
+
+ The `-F' option inhibits the display of function definitions; only
+ the function name and attributes are printed. If the `extdebug'
+ shell option is enabled using `shopt' (*note The Shopt Builtin::),
+ the source file name and line number where the function is defined
+ are displayed as well. `-F' implies `-f'. The following options
+ can be used to restrict output to variables with the specified
attributes or to give variables attributes:
`-a'
- Each NAME is an array variable (*note Arrays::).
+ Each NAME is an indexed array variable (*note Arrays::).
+
+ `-A'
+ Each NAME is an associative array variable (*note Arrays::).
`-f'
Use function names only.
@@ -2786,6 +2927,11 @@ POSIX standard.
evaluation (*note Shell Arithmetic::) is performed when the
variable is assigned a value.
+ `-l'
+ When the variable is assigned a value, all upper-case
+ characters are converted to lower-case. The upper-case
+ attribute is disabled.
+
`-r'
Make NAMEs readonly. These names cannot then be assigned
values by subsequent assignment statements or unset.
@@ -2795,14 +2941,21 @@ POSIX standard.
inherit the `DEBUG' and `RETURN' traps from the calling shell.
The trace attribute has no special meaning for variables.
+ `-u'
+ When the variable is assigned a value, all lower-case
+ characters are converted to upper-case. The lower-case
+ attribute is disabled.
+
`-x'
Mark each NAME for export to subsequent commands via the
environment.
- Using `+' instead of `-' turns off the attribute instead. When
- used in a function, `declare' makes each NAME local, as with the
- `local' command. If a variable name is followed by =VALUE, the
- value of the variable is set to VALUE.
+ Using `+' instead of `-' turns off the attribute instead, with the
+ exceptions that `+a' may not be used to destroy an array variable
+ and `+r' will not remove the readonly attribute. When used in a
+ function, `declare' makes each NAME local, as with the `local'
+ command. If a variable name is followed by =VALUE, the value of
+ the variable is set to VALUE.
The return status is zero unless an invalid option is encountered,
an attempt is made to define a function using `-f foo=bar', an
@@ -2835,7 +2988,7 @@ POSIX standard.
backspace
`\c'
- suppress trailing newline
+ suppress further output
`\e'
escape
@@ -2867,7 +3020,7 @@ POSIX standard.
HH (one or two hex digits)
`enable'
- enable [-n] [-p] [-f FILENAME] [-ads] [NAME ...]
+ enable [-a] [-dnps] [-f FILENAME] [NAME ...]
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, even though the
@@ -2895,19 +3048,30 @@ POSIX standard.
there is an error loading a new builtin from a shared object.
`help'
- help [-s] [PATTERN]
+ help [-dms] [PATTERN]
Display helpful information about builtin commands. If PATTERN is
specified, `help' gives detailed help on all commands matching
- PATTERN, otherwise a list of the builtins is printed. The `-s'
- option restricts the information displayed to a short usage
- synopsis. The return status is zero unless no command matches
- PATTERN.
+ PATTERN, otherwise a list of the builtins is printed.
+
+ Options, if supplied, have the following meanings:
+
+ `-d'
+ Display a short description of each PATTERN
+
+ `-m'
+ Display the description of each PATTERN in a manpage-like
+ format
+
+ `-s'
+ Display only a short usage synopsis for each PATTERN
+
+ The return status is zero unless no command matches PATTERN.
`let'
let EXPRESSION [EXPRESSION]
The `let' builtin allows arithmetic to be performed on shell
variables. Each EXPRESSION is evaluated according to the rules
- given below in *Note Shell Arithmetic::. If the last EXPRESSION
+ given below in *note Shell Arithmetic::. If the last EXPRESSION
evaluates to 0, `let' returns 1; otherwise 0 is returned.
`local'
@@ -2924,8 +3088,49 @@ POSIX standard.
logout [N]
Exit a login shell, returning a status of N to the shell's parent.
+`mapfile'
+ mapfile [-n COUNT] [-O ORIGIN] [-s COUNT] [-t] [-u FD] [
+ -C CALLBACK] [-c QUANTUM] [ARRAY]
+ Read lines from the standard input into array variable ARRAY, or
+ from file descriptor FD if the `-u' option is supplied. The
+ variable `MAPFILE' is the default ARRAY. Options, if supplied,
+ have the following meanings:
+ `-n'
+ Copy at most COUNT lines. If COUNT is 0, all lines are
+ copied.
+
+ `-O'
+ Begin assigning to ARRAY at index ORIGIN. The default index
+ is 0.
+
+ `-s'
+ Discard the first COUNT lines read.
+
+ `-t'
+ Remove a trailing line from each line read.
+
+ `-u'
+ Read lines from file descriptor FD instead of the standard
+ input.
+
+ `-C'
+ Evaluate CALLBACK each time QUANTUMP lines are read. The
+ `-c' option specifies QUANTUM.
+
+ `-c'
+ Specify the number of lines read between each call to
+ CALLBACK.
+
+ If `-C' is specified without `-c', the default quantum is 5000.
+
+ If not supplied with an explicit origin, `mapfile' will clear ARRAY
+ before assigning to it.
+
+ `mapfile' returns successfully unless an invalid option or option
+ argument is supplied, or ARRAY is invalid or unassignable.
+
`printf'
- `printf' [-v VAR] FORMAT [ARGUMENTS]
+ printf [-v VAR] FORMAT [ARGUMENTS]
Write the formatted ARGUMENTS to the standard output under the
control of the FORMAT. The FORMAT is a character string which
contains three types of objects: plain characters, which are
@@ -2950,7 +3155,7 @@ POSIX standard.
success, non-zero on failure.
`read'
- read [-ers] [-a ANAME] [-d DELIM] [-n NCHARS] [-p PROMPT] [-t TIMEOUT] [-u FD] [NAME ...]
+ read [-ers] [-a ANAME] [-d DELIM] [-i TEXT] [-n NCHARS] [-p PROMPT] [-t TIMEOUT] [-u FD] [NAME ...]
One line is read from the standard input, or from the file
descriptor FD supplied as an argument to the `-u' option, and the
first word is assigned to the first NAME, the second word to the
@@ -2963,9 +3168,10 @@ POSIX standard.
next character read and for line continuation. If no names are
supplied, the line read is assigned to the variable `REPLY'. The
return code is zero, unless end-of-file is encountered, `read'
- times out, or an invalid file descriptor is supplied as the
- argument to `-u'. Options, if supplied, have the following
- meanings:
+ times out (in which case the return code is greater than 128), or
+ an invalid file descriptor is supplied as the argument to `-u'.
+
+ Options, if supplied, have the following meanings:
`-a ANAME'
The words are assigned to sequential indices of the array
@@ -2979,7 +3185,12 @@ POSIX standard.
`-e'
Readline (*note Command Line Editing::) is used to obtain the
- line.
+ line. Readline uses the current (or default, if line editing
+ was not previously active) editing settings.
+
+ `-i TEXT'
+ If Readline is being used to read the line, TEXT is placed
+ into the editing buffer before editing begins.
`-n NCHARS'
`read' returns after reading NCHARS characters rather than
@@ -3002,245 +3213,19 @@ POSIX standard.
`-t TIMEOUT'
Cause `read' to time out and return failure if a complete
- line of input is not read within TIMEOUT seconds. This
- option has no effect if `read' is not reading input from the
- terminal or a pipe.
+ line of input is not read within TIMEOUT seconds. TIMEOUT
+ may be a decimal number with a fractional portion following
+ the decimal point. This option is only effective if `read'
+ is reading input from a terminal, pipe, or other special
+ file; it has no effect when reading from regular files. If
+ TIMEOUT is 0, `read' returns success if input is available on
+ the specified file descriptor, failure otherwise. The exit
+ status is greater than 128 if the timeout is exceeded.
`-u FD'
Read input from file descriptor FD.
-`shopt'
- shopt [-pqsu] [-o] [OPTNAME ...]
- Toggle the values of variables controlling optional shell behavior.
- With no options, or with the `-p' option, a list of all settable
- options is displayed, with an indication of whether or not each is
- set. The `-p' option causes output to be displayed in a form that
- may be reused as input. Other options have the following meanings:
-
- `-s'
- Enable (set) each OPTNAME.
-
- `-u'
- Disable (unset) each OPTNAME.
-
- `-q'
- Suppresses normal output; the return status indicates whether
- the OPTNAME is set or unset. If multiple OPTNAME arguments
- are given with `-q', the return status is zero if all
- OPTNAMES are enabled; non-zero otherwise.
-
- `-o'
- Restricts the values of OPTNAME to be those defined for the
- `-o' option to the `set' builtin (*note The Set Builtin::).
-
- If either `-s' or `-u' is used with no OPTNAME arguments, the
- display is limited to those options which are set or unset,
- respectively.
-
- Unless otherwise noted, the `shopt' options are disabled (off) by
- default.
-
- The return status when listing options is zero if all OPTNAMES are
- enabled, non-zero otherwise. When setting or unsetting options,
- the return status is zero unless an OPTNAME is not a valid shell
- option.
-
- The list of `shopt' options is:
- `cdable_vars'
- If this is set, an argument to the `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.
-
- `cdspell'
- If set, minor errors in the spelling of a directory component
- in a `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.
-
- `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.
-
- `checkwinsize'
- If set, Bash checks the window size after each command and,
- if necessary, updates the values of `LINES' and `COLUMNS'.
-
- `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.
-
- `dotglob'
- If set, Bash includes filenames beginning with a `.' in the
- results of filename expansion.
-
- `execfail'
- If this is set, a non-interactive shell will not exit if it
- cannot execute the file specified as an argument to the `exec'
- builtin command. An interactive shell does not exit if `exec'
- fails.
-
- `expand_aliases'
- If set, aliases are expanded as described below under Aliases,
- *Note Aliases::. This option is enabled by default for
- interactive shells.
-
- `extdebug'
- If set, behavior intended for use by debuggers is enabled:
-
- 1. The `-F' option to the `declare' builtin (*note Bash
- Builtins::) displays the source file name and line
- number corresponding to each function name supplied as
- an argument.
-
- 2. If the command run by the `DEBUG' trap returns a
- non-zero value, the next command is skipped and not
- executed.
-
- 3. If the command run by the `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 `.' or
- `source' builtins), a call to `return' is simulated.
-
- 4. `BASH_ARGC' and `BASH_ARGV' are updated as described in
- their descriptions (*note Bash Variables::).
-
- 5. Function tracing is enabled: command substitution,
- shell functions, and subshells invoked with `( COMMAND
- )' inherit the `DEBUG' and `RETURN' traps.
-
- 6. Error tracing is enabled: command substitution, shell
- functions, and subshells invoked with `( COMMAND )'
- inherit the `ERROR' trap.
-
- `extglob'
- If set, the extended pattern matching features described above
- (*note Pattern Matching::) are enabled.
-
- `extquote'
- If set, `$'STRING'' and `$"STRING"' quoting is performed
- within `${PARAMETER}' expansions enclosed in double quotes.
- This option is enabled by default.
-
- `failglob'
- If set, patterns which fail to match filenames during
- pathname expansion result in an expansion error.
-
- `force_fignore'
- If set, the suffixes specified by the `FIGNORE' shell variable
- cause words to be ignored when performing word completion
- even if the ignored words are the only possible completions.
- *Note Bash Variables::, for a description of `FIGNORE'. This
- option is enabled by default.
-
- `gnu_errfmt'
- If set, shell error messages are written in the standard GNU
- error message format.
-
- `histappend'
- If set, the history list is appended to the file named by the
- value of the `HISTFILE' variable when the shell exits, rather
- than overwriting the file.
-
- `histreedit'
- If set, and Readline is being used, a user is given the
- opportunity to re-edit a failed history substitution.
-
- `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.
-
- `hostcomplete'
- If set, and Readline is being used, Bash will attempt to
- perform hostname completion when a word containing a `@' is
- being completed (*note Commands For Completion::). This
- option is enabled by default.
-
- `huponexit'
- If set, Bash will send `SIGHUP' to all jobs when an
- interactive login shell exits (*note Signals::).
-
- `interactive_comments'
- Allow a word beginning with `#' to cause that word and all
- remaining characters on that line to be ignored in an
- interactive shell. This option is enabled by default.
-
- `lithist'
- If enabled, and the `cmdhist' option is enabled, multi-line
- commands are saved to the history with embedded newlines
- rather than using semicolon separators where possible.
-
- `login_shell'
- The shell sets this option if it is started as a login shell
- (*note Invoking Bash::). The value may not be changed.
-
- `mailwarn'
- If set, and a file that Bash is checking for mail has been
- accessed since the last time it was checked, the message
- `"The mail in MAILFILE has been read"' is displayed.
-
- `no_empty_cmd_completion'
- If set, and Readline is being used, Bash will not attempt to
- search the `PATH' for possible completions when completion is
- attempted on an empty line.
-
- `nocaseglob'
- If set, Bash matches filenames in a case-insensitive fashion
- when performing filename expansion.
-
- `nocasematch'
- If set, Bash matches patterns in a case-insensitive fashion
- when performing matching while executing `case' or `[['
- conditional commands.
-
- `nullglob'
- If set, Bash allows filename patterns which match no files to
- expand to a null string, rather than themselves.
-
- `progcomp'
- If set, the programmable completion facilities (*note
- Programmable Completion::) are enabled. This option is
- enabled by default.
-
- `promptvars'
- If set, prompt strings undergo parameter expansion, command
- substitution, arithmetic expansion, and quote removal after
- being expanded as described below (*note Printing a Prompt::).
- This option is enabled by default.
-
- `restricted_shell'
- The shell sets this option if it is started in restricted mode
- (*note 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.
-
- `shift_verbose'
- If this is set, the `shift' builtin prints an error message
- when the shift count exceeds the number of positional
- parameters.
-
- `sourcepath'
- If set, the `source' builtin uses the value of `PATH' to find
- the directory containing the file supplied as an argument.
- This option is enabled by default.
-
- `xpg_echo'
- If set, the `echo' builtin expands backslash-escape sequences
- by default.
-
-
- The return status when listing options is zero if all OPTNAMES are
- enabled, non-zero otherwise. When setting or unsetting options,
- the return status is zero unless an OPTNAME is not a valid shell
- option.
-
`source'
source FILENAME
A synonym for `.' (*note Bourne Shell Builtins::).
@@ -3273,8 +3258,8 @@ POSIX standard.
If the `-f' option is used, `type' does not attempt to find shell
functions, as with the `command' builtin.
- The return status is zero if any of the NAMES are found, non-zero
- if none are found.
+ The return status is zero if all of the NAMES are found, non-zero
+ if any are not found.
`typeset'
typeset [-afFrxi] [-p] [NAME[=VALUE] ...]
@@ -3283,7 +3268,7 @@ POSIX standard.
builtin command.
`ulimit'
- ulimit [-acdefilmnpqrstuvxSH] [LIMIT]
+ ulimit [-abcdefilmnpqrstuvxHST] [LIMIT]
`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:
@@ -3296,6 +3281,9 @@ POSIX standard.
`-a'
All current limits are reported.
+ `-b'
+ The maximum socket buffer size.
+
`-c'
The maximum size of core files created.
@@ -3345,12 +3333,17 @@ POSIX standard.
`-x'
The maximum number of file locks.
+ `-T'
+ The maximum number of threads.
+
If LIMIT is given, it is the new value of the specified resource;
the special LIMIT values `hard', `soft', and `unlimited' stand for
the current hard limit, the current soft limit, and no limit,
- respectively. Otherwise, the current value of the soft limit for
- the specified resource is printed, unless the `-H' option is
+ 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 `-H' option is
supplied. When setting new limits, if neither `-H' nor `-S' is
supplied, both the hard and soft limits are set. If no option is
given, then `-f' is assumed. Values are in 1024-byte increments,
@@ -3364,19 +3357,34 @@ POSIX standard.
unalias [-a] [NAME ... ]
Remove each NAME from the list of aliases. If `-a' is supplied,
- all aliases are removed. Aliases are described in *Note Aliases::.
+ all aliases are removed. Aliases are described in *note Aliases::.

-File: bashref.info, Node: The Set Builtin, Next: Special Builtins, Prev: Bash Builtins, Up: Shell Builtin Commands
+File: bashref.info, Node: Modifying Shell Behavior, Next: Special Builtins, Prev: Bash Builtins, Up: Shell Builtin Commands
-4.3 The Set Builtin
-===================
+4.3 Modifying Shell Behavior
+============================
+
+* Menu:
+
+* The Set Builtin:: Change the values of shell attributes and
+ positional parameters.
+* The Shopt Builtin:: Modify shell optional behavior.
+
+
+File: bashref.info, Node: The Set Builtin, Next: The Shopt Builtin, Up: Modifying Shell Behavior
+
+4.3.1 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. `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.
`set'
- set [--abefhkmnptuvxBCHP] [-o OPTION] [ARGUMENT ...]
+ set [--abefhkmnptuvxBCEHPT] [-o OPTION] [ARGUMENT ...]
+ set [+abefhkmnptuvxBCEHPT] [+o OPTION] [ARGUMENT ...]
If no options or arguments are supplied, `set' displays the names
and values of all shell variables and functions, sorted according
@@ -3402,8 +3410,12 @@ This builtin is so complicated that it deserves its own section.
Commands::) exits with a non-zero status, unless the command
that fails is part of the command list immediately following
a `while' or `until' keyword, part of the test in an `if'
- statement, part of a `&&' or `||' list, or if the command's
- return status is being inverted using `!'. A trap on `ERR',
+ statement, part of a command executed in a `&&' or `||b' list,
+ any command in a pipeline but the last, or if the command's
+ return status is being inverted using `!'. Failing simple
+ commands that are part of shell functions or command lists
+ enclosed in braces or parentheses satisfying the above
+ conditions do not cause the shell to exit. A trap on `ERR',
if set, is executed before the shell exits.
`-f'
@@ -3437,7 +3449,8 @@ This builtin is so complicated that it deserves its own section.
`emacs'
Use an `emacs'-style line editing interface (*note
- Command Line Editing::).
+ Command Line Editing::). This also affects the editing
+ interface used for `read -e'.
`errexit'
Same as `-e'.
@@ -3455,7 +3468,7 @@ This builtin is so complicated that it deserves its own section.
Same as `-H'.
`history'
- Enable command history, as described in *Note Bash
+ Enable command history, as described in *note Bash
History Facilities::. This option is on by default in
interactive shells.
@@ -3511,7 +3524,8 @@ This builtin is so complicated that it deserves its own section.
Same as `-v'.
`vi'
- Use a `vi'-style line editing interface.
+ Use a `vi'-style line editing interface. This also
+ affects the editing interface used for `read -e'.
`xtrace'
Same as `-x'.
@@ -3519,15 +3533,16 @@ This builtin is so complicated that it deserves its own section.
`-p'
Turn on privileged mode. In this mode, the `$BASH_ENV' and
`$ENV' files are not processed, shell functions are not
- inherited from the environment, and the `SHELLOPTS' variable,
- if it appears in the environment, is ignored. If the shell
- is started with the effective user (group) id not equal to the
- real user (group) id, and the `-p' option is not supplied,
- these actions are taken and the effective user id is set to
- the real user id. If the `-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.
+ inherited from the environment, and the `SHELLOPTS', `CDPATH'
+ and `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 `-p' option is not supplied, these actions are
+ taken and the effective user id is set to the real user id.
+ If the `-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.
`-t'
Exit after reading and executing one command.
@@ -3617,7 +3632,276 @@ This builtin is so complicated that it deserves its own section.
supplied.

-File: bashref.info, Node: Special Builtins, Prev: The Set Builtin, Up: Shell Builtin Commands
+File: bashref.info, Node: The Shopt Builtin, Prev: The Set Builtin, Up: Modifying Shell Behavior
+
+4.3.2 The Shopt Builtin
+-----------------------
+
+This builtin allows you to change additional shell optional behavior.
+
+`shopt'
+ shopt [-pqsu] [-o] [OPTNAME ...]
+ Toggle the values of variables controlling optional shell behavior.
+ With no options, or with the `-p' option, a list of all settable
+ options is displayed, with an indication of whether or not each is
+ set. The `-p' option causes output to be displayed in a form that
+ may be reused as input. Other options have the following meanings:
+
+ `-s'
+ Enable (set) each OPTNAME.
+
+ `-u'
+ Disable (unset) each OPTNAME.
+
+ `-q'
+ Suppresses normal output; the return status indicates whether
+ the OPTNAME is set or unset. If multiple OPTNAME arguments
+ are given with `-q', the return status is zero if all
+ OPTNAMES are enabled; non-zero otherwise.
+
+ `-o'
+ Restricts the values of OPTNAME to be those defined for the
+ `-o' option to the `set' builtin (*note The Set Builtin::).
+
+ If either `-s' or `-u' is used with no OPTNAME arguments, the
+ display is limited to those options which are set or unset,
+ respectively.
+
+ Unless otherwise noted, the `shopt' options are disabled (off) by
+ default.
+
+ The return status when listing options is zero if all OPTNAMES are
+ enabled, non-zero otherwise. When setting or unsetting options,
+ the return status is zero unless an OPTNAME is not a valid shell
+ option.
+
+ The list of `shopt' options is:
+ `autocd'
+ If set, a command name that is the name of a directory is
+ executed as if it were the argument to the `cd' command.
+ This option is only used by interactive shells.
+
+ `cdable_vars'
+ If this is set, an argument to the `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.
+
+ `cdspell'
+ If set, minor errors in the spelling of a directory component
+ in a `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.
+
+ `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.
+
+ `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 (*note Job
+ Control::). The shell always postpones exiting if any jobs
+ are stopped.
+
+ `checkwinsize'
+ If set, Bash checks the window size after each command and,
+ if necessary, updates the values of `LINES' and `COLUMNS'.
+
+ `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.
+
+ `compat31'
+ If set, Bash changes its behavior to that of version 3.1 with
+ respect to quoted arguments to the conditional command's =~
+ operator.
+
+ `dirspell'
+ If set, Bash attempts spelling correction on directory names
+ during word completion if the directory name initially
+ supplied does not exist.
+
+ `dotglob'
+ If set, Bash includes filenames beginning with a `.' in the
+ results of filename expansion.
+
+ `execfail'
+ If this is set, a non-interactive shell will not exit if it
+ cannot execute the file specified as an argument to the `exec'
+ builtin command. An interactive shell does not exit if `exec'
+ fails.
+
+ `expand_aliases'
+ If set, aliases are expanded as described below under Aliases,
+ *note Aliases::. This option is enabled by default for
+ interactive shells.
+
+ `extdebug'
+ If set, behavior intended for use by debuggers is enabled:
+
+ 1. The `-F' option to the `declare' builtin (*note Bash
+ Builtins::) displays the source file name and line
+ number corresponding to each function name supplied as
+ an argument.
+
+ 2. If the command run by the `DEBUG' trap returns a
+ non-zero value, the next command is skipped and not
+ executed.
+
+ 3. If the command run by the `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 `.' or
+ `source' builtins), a call to `return' is simulated.
+
+ 4. `BASH_ARGC' and `BASH_ARGV' are updated as described in
+ their descriptions (*note Bash Variables::).
+
+ 5. Function tracing is enabled: command substitution,
+ shell functions, and subshells invoked with `( COMMAND
+ )' inherit the `DEBUG' and `RETURN' traps.
+
+ 6. Error tracing is enabled: command substitution, shell
+ functions, and subshells invoked with `( COMMAND )'
+ inherit the `ERROR' trap.
+
+ `extglob'
+ If set, the extended pattern matching features described above
+ (*note Pattern Matching::) are enabled.
+
+ `extquote'
+ If set, `$'STRING'' and `$"STRING"' quoting is performed
+ within `${PARAMETER}' expansions enclosed in double quotes.
+ This option is enabled by default.
+
+ `failglob'
+ If set, patterns which fail to match filenames during
+ pathname expansion result in an expansion error.
+
+ `force_fignore'
+ If set, the suffixes specified by the `FIGNORE' shell variable
+ cause words to be ignored when performing word completion
+ even if the ignored words are the only possible completions.
+ *Note Bash Variables::, for a description of `FIGNORE'. This
+ option is enabled by default.
+
+ `globstar'
+ If set, the pattern `**' used in a filename expansion context
+ will match a files and zero or more directories and
+ subdirectories. If the pattern is followed by a `/', only
+ directories and subdirectories match.
+
+ `gnu_errfmt'
+ If set, shell error messages are written in the standard GNU
+ error message format.
+
+ `histappend'
+ If set, the history list is appended to the file named by the
+ value of the `HISTFILE' variable when the shell exits, rather
+ than overwriting the file.
+
+ `histreedit'
+ If set, and Readline is being used, a user is given the
+ opportunity to re-edit a failed history substitution.
+
+ `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.
+
+ `hostcomplete'
+ If set, and Readline is being used, Bash will attempt to
+ perform hostname completion when a word containing a `@' is
+ being completed (*note Commands For Completion::). This
+ option is enabled by default.
+
+ `huponexit'
+ If set, Bash will send `SIGHUP' to all jobs when an
+ interactive login shell exits (*note Signals::).
+
+ `interactive_comments'
+ Allow a word beginning with `#' to cause that word and all
+ remaining characters on that line to be ignored in an
+ interactive shell. This option is enabled by default.
+
+ `lithist'
+ If enabled, and the `cmdhist' option is enabled, multi-line
+ commands are saved to the history with embedded newlines
+ rather than using semicolon separators where possible.
+
+ `login_shell'
+ The shell sets this option if it is started as a login shell
+ (*note Invoking Bash::). The value may not be changed.
+
+ `mailwarn'
+ If set, and a file that Bash is checking for mail has been
+ accessed since the last time it was checked, the message
+ `"The mail in MAILFILE has been read"' is displayed.
+
+ `no_empty_cmd_completion'
+ If set, and Readline is being used, Bash will not attempt to
+ search the `PATH' for possible completions when completion is
+ attempted on an empty line.
+
+ `nocaseglob'
+ If set, Bash matches filenames in a case-insensitive fashion
+ when performing filename expansion.
+
+ `nocasematch'
+ If set, Bash matches patterns in a case-insensitive fashion
+ when performing matching while executing `case' or `[['
+ conditional commands.
+
+ `nullglob'
+ If set, Bash allows filename patterns which match no files to
+ expand to a null string, rather than themselves.
+
+ `progcomp'
+ If set, the programmable completion facilities (*note
+ Programmable Completion::) are enabled. This option is
+ enabled by default.
+
+ `promptvars'
+ If set, prompt strings undergo parameter expansion, command
+ substitution, arithmetic expansion, and quote removal after
+ being expanded as described below (*note Printing a Prompt::).
+ This option is enabled by default.
+
+ `restricted_shell'
+ The shell sets this option if it is started in restricted mode
+ (*note 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.
+
+ `shift_verbose'
+ If this is set, the `shift' builtin prints an error message
+ when the shift count exceeds the number of positional
+ parameters.
+
+ `sourcepath'
+ If set, the `source' builtin uses the value of `PATH' to find
+ the directory containing the file supplied as an argument.
+ This option is enabled by default.
+
+ `xpg_echo'
+ If set, the `echo' builtin expands backslash-escape sequences
+ by default.
+
+
+ The return status when listing options is zero if all OPTNAMES are
+ enabled, non-zero otherwise. When setting or unsetting options,
+ the return status is zero unless an OPTNAME is not a valid shell
+ option.
+
+
+
+File: bashref.info, Node: Special Builtins, Prev: Modifying Shell Behavior, Up: Shell Builtin Commands
4.4 Special Builtins
====================
@@ -3638,7 +3922,7 @@ respects:
When Bash is not executing in POSIX mode, these builtins behave no
differently than the rest of the Bash builtin commands. The Bash POSIX
-mode is described in *Note Bash POSIX Mode::.
+mode is described in *note Bash POSIX Mode::.
These are the POSIX special builtins:
break : . continue eval exec exit export readonly return set
@@ -3732,6 +4016,18 @@ Variables::).
`BASH'
The full pathname used to execute the current instance of Bash.
+`BASHPID'
+ Expands to the process id of the current Bash process. This
+ differs from `$$' under certain circumstances, such as subshells
+ that do not require Bash to be re-initialized.
+
+`BASH_ALIASES'
+ An associative array variable whose members correspond to the
+ internal list of aliases as maintained by the `alias' builtin
+ (*note Bourne Shell Builtins::). Elements added to this array
+ appear in the alias list; unsetting array elements cause aliases
+ to be removed from the alias list.
+
`BASH_ARGC'
An array variable whose values are the number of parameters in each
frame of the current bash execution call stack. The number of
@@ -3739,7 +4035,7 @@ Variables::).
executed with `.' or `source') is at the top of the stack. When a
subroutine is executed, the number of parameters passed is pushed
onto `BASH_ARGC'. The shell sets `BASH_ARGC' only when in
- extended debugging mode (see *Note Bash Builtins:: for a
+ extended debugging mode (see *note The Shopt Builtin:: for a
description of the `extdebug' option to the `shopt' builtin).
`BASH_ARGV'
@@ -3748,9 +4044,16 @@ Variables::).
subroutine call is at the top of the stack; the first parameter of
the initial call is at the bottom. When a subroutine is executed,
the parameters supplied are pushed onto `BASH_ARGV'. The shell
- sets `BASH_ARGV' only when in extended debugging mode (see *Note
- Bash Builtins:: for a description of the `extdebug' option to the
- `shopt' builtin).
+ sets `BASH_ARGV' only when in extended debugging mode (see *note
+ The Shopt Builtin:: for a description of the `extdebug' option to
+ the `shopt' builtin).
+
+`BASH_CMDS'
+ An associative array variable whose members correspond to the
+ internal hash table of commands as maintained by the `hash' builtin
+ (*note Bourne Shell Builtins::). Elements added to this array
+ appear in the hash table; unsetting array elements cause commands
+ to be removed from the hash table.
`BASH_COMMAND'
The command currently being executed or about to be executed,
@@ -3770,9 +4073,10 @@ Variables::).
An array variable whose members are the line numbers in source
files corresponding to each member of FUNCNAME.
`${BASH_LINENO[$i]}' is the line number in the source file where
- `${FUNCNAME[$i]}' was called. The corresponding source file name
- is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain the current line
- number.
+ `${FUNCNAME[$i]}' was called (or `${BASH_LINENO[$i-1]}' if
+ referenced within another shell function). The corresponding
+ source file name is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain
+ the current line number.
`BASH_REMATCH'
An array variable whose members are assigned by the `=~' binary
@@ -3841,6 +4145,20 @@ Variables::).
functions and external commands invoked by the programmable
completion facilities (*note Programmable Completion::).
+`COMP_TYPE'
+ Set to an integer value corresponding to the type of completion
+ attempted that caused a completion function to be called: TAB, for
+ normal completion, `?', for listing completions after successive
+ tabs, `!', for listing alternatives on partial word completion,
+ `@', to list completions if the word is not unmodified, or `%',
+ for menu completion. This variable is available only in shell
+ functions and external commands invoked by the programmable
+ completion facilities (*note Programmable Completion::).
+
+`COMP_KEY'
+ The key (or final key of a key sequence) used to invoke the current
+ completion function.
+
`COMP_WORDBREAKS'
The set of characters that the Readline library treats as word
separators when performing word completion. If `COMP_WORDBREAKS'
@@ -3892,7 +4210,7 @@ Variables::).
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". This variable exists only when a
+ bottom-most element is `"main"'. This variable exists only when a
shell function is executing. Assignments to `FUNCNAME' have no
effect and return an error status. If `FUNCNAME' is unset, it
loses its special properties, even if it is subsequently reset.
@@ -3985,7 +4303,9 @@ Variables::).
format string for STRFTIME to print the time stamp associated with
each history entry displayed by the `history' builtin. If this
variable is set, time stamps are written to the history file so
- they may be preserved across shell sessions.
+ they may be preserved across shell sessions. This uses the
+ history comment character to distinguish timestamps from other
+ history lines.
`HOSTFILE'
Contains the name of a file in the same format as `/etc/hosts' that
@@ -4099,6 +4419,12 @@ Variables::).
If set, the value is interpreted as a command to execute before
the printing of each primary prompt (`$PS1').
+`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 `\w' and `\W' prompt string escapes (*note Printing a
+ Prompt::). Characters removed are replaced with an ellipsis.
+
`PS3'
The value of this variable is used as the prompt for the `select'
command. If this variable is not set, the `select' command
@@ -4191,7 +4517,7 @@ Variables::).
if input does not arrive after `TMOUT' seconds when input is coming
from a terminal.
- In an interative shell, the value is interpreted as the number of
+ In an interactive shell, the value is interpreted as the number of
seconds to wait for input after issuing the primary prompt when
the shell is interactive. Bash terminates after that number of
seconds if input does not arrive.
@@ -4247,10 +4573,10 @@ the single-character options to be recognized.
`--debugger'
Arrange for the debugger profile to be executed before the shell
- starts. Turns on extended debugging mode (see *Note Bash
- Builtins:: for a description of the `extdebug' option to the
- `shopt' builtin) and shell function tracing (see *Note The Set
- Builtin:: for a description of the `-o functrace' option).
+ starts. Turns on extended debugging mode (see *note The Shopt
+ Builtin:: for a description of the `extdebug' option to the `shopt'
+ builtin) and shell function tracing (see *note The Set Builtin::
+ for a description of the `-o functrace' option).
`--dump-po-strings'
A list of all double-quoted strings preceded by `$' is printed on
@@ -4261,7 +4587,7 @@ the single-character options to be recognized.
Equivalent to `-D'.
`--help'
- Display a usage message on standard output and exit sucessfully.
+ Display a usage message on standard output and exit successfully.
`--init-file FILENAME'
`--rcfile FILENAME'
@@ -4312,7 +4638,7 @@ invocation which are not available with the `set' builtin.
`-i'
Force the shell to run interactively. Interactive shells are
- described in *Note Interactive Shells::.
+ described in *note Interactive Shells::.
`-l'
Make this shell act as if it had been directly invoked by login.
@@ -4341,8 +4667,8 @@ invocation which are not available with the `set' builtin.
`[-+]O [SHOPT_OPTION]'
SHOPT_OPTION is one of the shell options accepted by the `shopt'
- builtin (*note Shell Builtin Commands::). If SHOPT_OPTION is
- present, `-O' sets the value of that option; `+O' unsets it. If
+ builtin (*note The Shopt Builtin::). If SHOPT_OPTION is present,
+ `-O' sets the value of that option; `+O' unsets it. If
SHOPT_OPTION is not supplied, the names and values of the shell
options accepted by `shopt' are printed on the standard output.
If the invocation option is `+O', the output is displayed in a
@@ -4378,12 +4704,12 @@ File: bashref.info, Node: Bash Startup Files, Next: Interactive Shells, Prev:
6.2 Bash Startup Files
======================
-This section describs how Bash executes its startup files. If any of
+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 Tilde Expansion (*note
Tilde Expansion::).
- Interactive shells are described in *Note Interactive Shells::.
+ Interactive shells are described in *note Interactive Shells::.
Invoked as an interactive login shell, or with `--login'
........................................................
@@ -4463,14 +4789,15 @@ startup files are read.
Invoked by remote shell daemon
..............................
-Bash attempts to determine when it is being run by the remote shell
-daemon, usually `rshd'. If Bash determines it is being run by rshd, it
-reads and executes commands from `~/.bashrc', if that file exists and
-is readable. It will not do this if invoked as `sh'. The `--norc'
-option may be used to inhibit this behavior, and the `--rcfile' option
-may be used to force another file to be read, but `rshd' does not
-generally invoke the shell with those options or allow them to be
-specified.
+Bash attempts to determine when it is being run with its standard input
+connected to a a network connection, as if by the remote shell daemon,
+usually `rshd', or the secure shell daemon `sshd'. If Bash determines
+it is being run in this fashion, it reads and executes commands from
+`~/.bashrc', if that file exists and is readable. It will not do this
+if invoked as `sh'. The `--norc' option may be used to inhibit this
+behavior, and the `--rcfile' option may be used to force another file
+to be read, but `rshd' does not generally invoke the shell with those
+options or allow them to be specified.
Invoked with unequal effective and real UID/GIDs
................................................
@@ -4502,9 +4829,9 @@ File: bashref.info, Node: What is an Interactive Shell?, Next: Is this Shell I
-----------------------------------
An interactive shell is one started without non-option arguments,
-unless `-s' is specified, without specifiying the `-c' option, and
-whose input and error output are both connected to terminals (as
-determined by `isatty(3)'), or one started with the `-i' option.
+unless `-s' is specified, without specifying the `-c' option, and whose
+input and error output are both connected to terminals (as determined
+by `isatty(3)'), or one started with the `-i' option.
An interactive shell generally reads from and writes to a user's
terminal.
@@ -4545,7 +4872,7 @@ File: bashref.info, Node: Interactive Shell Behavior, Prev: Is this Shell Inte
When the shell is running interactively, it changes its behavior in
several ways.
- 1. Startup files are read and executed as described in *Note Bash
+ 1. Startup files are read and executed as described in *note Bash
Startup Files::.
2. Job Control (*note Job Control::) is enabled by default. When job
@@ -4581,7 +4908,7 @@ several ways.
((*note Signals::). `SIGINT' will interrupt some shell builtins.
11. An interactive login shell sends a `SIGHUP' to all jobs on exit if
- the `hupoxexit' shell option has been enabled (*note Signals::).
+ the `huponexit' shell option has been enabled (*note Signals::).
12. The `-n' invocation option is ignored, and `set -n' has no effect
(*note The Set Builtin::).
@@ -4611,7 +4938,7 @@ several ways.
20. Simple spelling correction for directory arguments to the `cd'
builtin is enabled by default (see the description of the `cdspell'
- option to the `shopt' builtin in *Note Bash Builtins::).
+ option to the `shopt' builtin in *note The Shopt Builtin::).
21. The shell will check the value of the `TMOUT' variable and exit if
a command is not read within the specified number of seconds after
@@ -4876,8 +5203,8 @@ as in `csh'. If arguments are needed, a shell function should be used
(*note Shell Functions::).
Aliases are not expanded when the shell is not interactive, unless
-the `expand_aliases' shell option is set using `shopt' (*note Bash
-Builtins::).
+the `expand_aliases' shell option is set using `shopt' (*note The Shopt
+Builtin::).
The rules concerning the definition and use of aliases are somewhat
confusing. Bash always reads at least one complete line of input
@@ -4902,14 +5229,16 @@ File: bashref.info, Node: Arrays, Next: The Directory Stack, Prev: Aliases,
6.7 Arrays
==========
-Bash provides one-dimensional array variables. Any variable may be
-used as an array; the `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.
+Bash provides one-dimensional indexed and associative array variables.
+Any variable may be used as an indexed array; the `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. Indexed arrays are referenced using integers
+(including arithmetic expressions (*note Shell Arithmetic::) and are
+zero-based; associative arrays use arbitrary strings.
- 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
name[SUBSCRIPT]=VALUE
The SUBSCRIPT is treated as an arithmetic expression that must evaluate
@@ -4918,18 +5247,28 @@ array, use
declare -a NAME
The syntax
declare -a NAME[SUBSCRIPT]
- is also accepted; the SUBSCRIPT is ignored. Attributes may be
-specified for an array variable using the `declare' and `readonly'
-builtins. Each attribute applies to all members of an array.
+ is also accepted; the SUBSCRIPT is ignored.
+
+ Associative arrays are created using
+ declare -A NAME.
+
+ Attributes may be specified for an array variable using the
+`declare' and `readonly' builtins. Each attribute applies to all
+members of an array.
Arrays are assigned to using compound assignments of the form
name=(value1 ... valueN)
- where each VALUE is of the form `[[SUBSCRIPT]=]'STRING. 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. This syntax is also
-accepted by the `declare' builtin. Individual array elements may be
-assigned to using the `name['SUBSCRIPT`]='VALUE syntax introduced above.
+ where each VALUE is of the form `[SUBSCRIPT]='STRING. Indexed array
+assignments do not require the bracket and subscript. 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 `declare' builtin. Individual
+array elements may be assigned to using the `name['SUBSCRIPT`]='VALUE
+syntax introduced above.
Any element of an array may be referenced using
`${name['SUBSCRIPT`]}'. The braces are required to avoid conflicts
@@ -4948,7 +5287,7 @@ expansion of the special parameters `@' and `*'.
`${#name['SUBSCRIPT`]}' expands to the length of `${name['SUBSCRIPT`]}'.
If SUBSCRIPT is `@' or `*', the expansion is the number of elements in
the array. Referencing an array variable without a subscript is
-equivalent to referencing element zero.
+equivalent to referencing with a subscript of 0.
The `unset' builtin is used to destroy arrays. `unset'
NAME[SUBSCRIPT] destroys the array element at index SUBSCRIPT. Care
@@ -4957,11 +5296,12 @@ generation. `unset' NAME, where NAME is an array, removes the entire
array. A subscript of `*' or `@' also removes the entire array.
The `declare', `local', and `readonly' builtins each accept a `-a'
-option to specify an array. The `read' builtin accepts a `-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 `set' and `declare' builtins display array values in a way that
-allows them to be reused as input.
+option to specify an indexed array and a `-A' option to specify an
+associative array. The `read' builtin accepts a `-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
+`set' and `declare' builtins display array values in a way that allows
+them to be reused as input.

File: bashref.info, Node: The Directory Stack, Next: Printing a Prompt, Prev: Arrays, Up: Bash Features
@@ -5042,12 +5382,17 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack
manipulated.
`pushd'
- pushd [DIR | +N | -N] [-n]
+ pushd [-n] [+N | -N | DIR ]
Save the current directory on the top of the directory stack and
then `cd' to DIR. With no arguments, `pushd' exchanges the top
two directories.
+ `-n'
+ Suppresses the normal change of directory when adding
+ directories to the stack, so that only the stack is
+ manipulated.
+
`+N'
Brings the Nth directory (counting from the left of the list
printed by `dirs', starting with zero) to the top of the list
@@ -5058,11 +5403,6 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack
printed by `dirs', starting with zero) to the top of the list
by rotating the stack.
- `-n'
- Suppresses the normal change of directory when adding
- directories to the stack, so that only the stack is
- manipulated.
-
`DIR'
Makes the current working directory be the top of the stack,
and then executes the equivalent of ``cd' DIR'. `cd's to DIR.
@@ -5141,7 +5481,7 @@ which can appear in the prompt variables:
`\w'
The current working directory, with `$HOME' abbreviated with a
- tilde.
+ tilde (uses the `$PROMPT_DIRTRIM' variable).
`\W'
The basename of `$PWD', with `$HOME' abbreviated with a tilde.
@@ -5389,13 +5729,16 @@ startup files.
`$PATH'.
40. The `vi' editing mode will invoke the `vi' editor directly when
- the `v' command is run, instead of checking `$FCEDIT' and
+ the `v' command is run, instead of checking `$VISUAL' and
`$EDITOR'.
41. When the `xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to `echo' as options. Each argument is
displayed, after escape characters are converted.
+ 42. The `ulimit' builtin uses a block size of 512 bytes for the `-c'
+ and `-f' options.
+
There is other POSIX behavior that Bash does not implement by
default even when in POSIX mode. Specifically:
@@ -5413,7 +5756,7 @@ specifying the `--enable-strict-posix-default' to `configure' when
building (*note Optional Features::).

-File: bashref.info, Node: Job Control, Next: Using History Interactively, Prev: Bash Features, Up: Top
+File: bashref.info, Node: Job Control, Next: Command Line Editing, Prev: Bash Features, Up: Top
7 Job Control
*************
@@ -5476,16 +5819,17 @@ 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 `%' introduces a job name.
+character `%' introduces a job specification (JOBSPEC).
Job number `n' may be referred to as `%n'. The symbols `%%' and
`%+' refer to the shell's notion of the current job, which is the last
job stopped while it was in the foreground or started in the background.
A single `%' (with no accompanying job specification) also refers to
-the current job. The previous job may be referenced using `%-'. In
-output pertaining to jobs (e.g., the output of the `jobs' command), the
-current job is always flagged with a `+', and the previous job with a
-`-'.
+the current job. The previous job may be referenced using `%-'. If
+there is only a single job, `%+' and `%-' can both be used to refer to
+that job. In output pertaining to jobs (e.g., the output of the `jobs'
+command), the current job is always flagged with a `+', and the
+previous job with a `-'.
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
@@ -5506,11 +5850,13 @@ output. If the `-b' option to the `set' builtin is enabled, Bash
reports such changes immediately (*note The Set Builtin::). Any trap
on `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. The `jobs'
+ If an attempt to exit Bash is made while jobs are stopped, (or
+running, if the `checkjobs' option is enabled - see *note The Shopt
+Builtin::), the shell prints a warning message, and if the `checkjobs'
+option is enabled, lists the jobs and their statuses. The `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.
+another warning, and any stopped jobs are terminated.

File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, Prev: Job Control Basics, Up: Job Control
@@ -5608,8 +5954,8 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables,
`suspend'
suspend [-f]
Suspend the execution of this shell until it receives a `SIGCONT'
- signal. The `-f' option means to suspend even if the shell is a
- login shell.
+ signal. A login shell cannot be suspended; the `-f' option can be
+ used to override this and force the suspension.
When job control is not active, the `kill' and `wait' builtins do
@@ -5640,7 +5986,7 @@ File: bashref.info, Node: Job Control Variables, Prev: Job Control Builtins,

-File: bashref.info, Node: Command Line Editing, Next: Installing Bash, Prev: Using History Interactively, Up: Top
+File: bashref.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Job Control, Up: Top
8 Command Line Editing
**********************
@@ -5648,6 +5994,15 @@ File: bashref.info, Node: Command Line Editing, Next: Installing Bash, Prev:
This chapter describes the basic features of the GNU command line
editing interface. Command line editing is provided by the Readline
library, which is used by several different programs, including Bash.
+Command line editing is enabled by default when using an interactive
+shell, unless the `--noediting' option is supplied at shell invocation.
+Line editing is also used when using the `-e' option to the `read'
+builtin command (*note Bash Builtins::). By default, the line editing
+commands are similar to those of emacs. A vi-style line editing
+interface is also available. Line editing can be enabled at any time
+using the `-o emacs' or `-o vi' options to the `set' builtin command
+(*note The Set Builtin::), or disabled using the `+o emacs' or `+o vi'
+options to `set'.
* Menu:
@@ -6008,6 +6363,13 @@ Variable Settings
completion in a case-insensitive fashion. The default value
is `off'.
+ `completion-prefix-display-length'
+ The length in characters of the common prefix of a list of
+ possible completions that is displayed without modification.
+ When set to a value greater than zero, common prefixes longer
+ than this value are replaced with an ellipsis when displaying
+ possible completions.
+
`completion-query-items'
The number of possible completions that determines when the
user is asked whether the list of possibilities should be
@@ -6045,9 +6407,15 @@ Variable Settings
attempts word completion. The default is `off'.
`history-preserve-point'
- If set to `on', the history code attempts to place point at
- the same location on each history line retrieved with
- `previous-history' or `next-history'. The default is `off'.
+ If set to `on', the history code attempts to place the point
+ (the current cursor position) at the same location on each
+ history line retrieved with `previous-history' or
+ `next-history'. The default is `off'.
+
+ `history-size'
+ Set the maximum number of history entries saved in the
+ history list. If set to zero, the number of entries in the
+ history list is not limited.
`horizontal-scroll-mode'
This variable can be set to either `on' or `off'. Setting it
@@ -6115,6 +6483,12 @@ Variable Settings
sorted horizontally in alphabetical order, rather than down
the screen. The default is `off'.
+ `revert-all-at-newline'
+ If set to `on', Readline will undo all changes to history
+ lines before returning when `accept-line' is executed. By
+ default, history lines may be modified and retain individual
+ undo lists across calls to `readline'. The default is `off'.
+
`show-all-if-ambiguous'
This alters the default behavior of the completion functions.
If set to `on', words which have more than one possible
@@ -6482,6 +6856,14 @@ File: bashref.info, Node: Commands For Moving, Next: Commands For History, Up
Move back to the start of the current or previous word. Words are
composed of letters and digits.
+`shell-forward-word ()'
+ Move forward to the end of the next word. Words are delimited by
+ non-quoted shell metacharacters.
+
+`shell-backward-word ()'
+ Move back to the start of the current or previous word. Words are
+ delimited by non-quoted shell metacharacters.
+
`clear-screen (C-l)'
Clear the screen and redraw the current line, leaving the current
line at the top of the screen.
@@ -6657,6 +7039,15 @@ File: bashref.info, Node: Commands For Killing, Next: Numeric Arguments, Prev
Kill the word behind point. Word boundaries are the same as
`backward-word'.
+`shell-kill-word ()'
+ Kill from point to the end of the current word, or if between
+ words, to the end of the next word. Word boundaries are the same
+ as `shell-forward-word'.
+
+`backward-kill-word ()'
+ Kill the word behind point. Word boundaries are the same as
+ `shell-backward-word'.
+
`unix-word-rubout (C-w)'
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
@@ -6804,6 +7195,11 @@ File: bashref.info, Node: Commands For Completion, Next: Keyboard Macros, Pre
against lines from the history list for possible completion
matches.
+`dabbrev-expand ()'
+ Attempt menu completion on the text before point, comparing the
+ text against lines from the history list for possible completion
+ matches.
+
`complete-into-braces (M-{)'
Perform filename completion and insert the list of possible
completions enclosed within braces so the list is available to the
@@ -7030,22 +7426,22 @@ and the matching words become the possible completions.
After these matches have been generated, any shell function or
command specified with the `-F' and `-C' options is invoked. When the
-command or function is invoked, the `COMP_LINE' and `COMP_POINT'
-variables are assigned values as described above (*note Bash
-Variables::). If a shell function is being invoked, the `COMP_WORDS'
-and `COMP_CWORD' variables are also set. When the function or command
-is invoked, the first argument is the name of the command whose
-arguments are being completed, the second argument is the word being
-completed, and the third argument is the word preceding the word being
-completed on the current command line. No filtering of the generated
-completions against the word being completed is performed; the function
-or command has complete freedom in generating the matches.
+command or function is invoked, the `COMP_LINE', `COMP_POINT',
+`COMP_KEY', and `COMP_TYPE' variables are assigned values as described
+above (*note Bash Variables::). If a shell function is being invoked,
+the `COMP_WORDS' and `COMP_CWORD' variables are also set. When the
+function or command is invoked, the first argument is the name of the
+command whose arguments are being completed, the second argument is the
+word being completed, and the third argument is the word preceding the
+word being completed on the current command line. No filtering of the
+generated completions against the word being completed is performed;
+the function or command has complete freedom in generating the matches.
Any function specified with `-F' is invoked first. The function may
-use any of the shell facilities, including the `compgen' builtin
-described below (*note Programmable Completion Builtins::), to generate
-the matches. It must put the possible completions in the `COMPREPLY'
-array variable.
+use any of the shell facilities, including the `compgen' and `compopt'
+builtins described below (*note Programmable Completion Builtins::), to
+generate the matches. It must put the possible completions in the
+`COMPREPLY' array variable.
Next, any command specified with the `-C' option is invoked in an
environment equivalent to command substitution. It should print a list
@@ -7119,17 +7515,19 @@ completion facilities.
no matches were generated.
`complete'
- `complete [-abcdefgjksuv] [-o COMP-OPTION] [-A ACTION] [-G GLOBPAT] [-W WORDLIST]
- [-P PREFIX] [-S SUFFIX] [-X FILTERPAT] [-F FUNCTION]
- [-C COMMAND] NAME [NAME ...]'
- `complete -pr [NAME ...]'
+ `complete [-abcdefgjksuv] [-o COMP-OPTION] [-E] [-A ACTION] [-G GLOBPAT] [-W WORDLIST]
+ [-F FUNCTION] [-C COMMAND] [-X FILTERPAT]
+ [-P PREFIX] [-S SUFFIX] NAME [NAME ...]'
+ `complete -pr [-E] [NAME ...]'
Specify how arguments to each NAME should be completed. If the
`-p' option is supplied, or if no options are supplied, existing
completion specifications are printed in a way that allows them to
be reused as input. The `-r' option removes a completion
specification for each NAME, or, if no NAMEs are supplied, all
- completion specifications.
+ completion specifications. The `-E' option indicates that the
+ remaining options and actions should apply to "empty" command
+ completion; that is, completion attempted on a blank line.
The process of applying these completion specifications when word
completion is attempted is described above (*note Programmable
@@ -7160,9 +7558,10 @@ completion facilities.
`filenames'
Tell Readline that the compspec generates filenames, so
it can perform any filename-specific processing (like
- adding a slash to directory names or suppressing
- trailing spaces). This option is intended to be used
- with shell functions specified with `-F'.
+ adding a slash to directory names quoting special
+ characters, or suppressing trailing spaces). This
+ option is intended to be used with shell functions
+ specified with `-F'.
`nospace'
Tell Readline not to append a space (the default) to
@@ -7300,9 +7699,21 @@ completion facilities.
for a NAME for which no specification exists, or an error occurs
adding a completion specification.
-
+`compopt'
+ `compopt' [-o OPTION] [+o OPTION] [NAME]
+ Modify completion options for each NAME according to the OPTIONs,
+ or for the currently-execution completion if no NAMEs are supplied.
+ If no OPTIONs are given, display the completion options for each
+ NAME or the current completion. The possible values of OPTION are
+ those valid for the `complete' builtin described above.
+
+ The return value is true unless an invalid option is supplied, an
+ attempt is made to modify the options for a NAME for which no
+ completion specification exists, or an output error occurs.
+
+

-File: bashref.info, Node: Using History Interactively, Next: Command Line Editing, Prev: Job Control, Up: Top
+File: bashref.info, Node: Using History Interactively, Next: Installing Bash, Prev: Command Line Editing, Up: Top
9 Using History Interactively
*****************************
@@ -7350,7 +7761,11 @@ history, the history file is truncated to contain no more than
performed.
If the `HISTTIMEFORMAT' is set, the time stamp information
-associated with each history entry is written to the history file.
+associated with each history entry is written to the history file,
+marked with the history comment character. When the history file is
+read, lines beginning with the history comment character followed
+immediately by a digit are interpreted as timestamps for the previous
+history line.
The builtin command `fc' may be used to list or edit and re-execute
a portion of the history list. The `history' builtin may be used to
@@ -7379,7 +7794,7 @@ Bash provides two builtin commands which manipulate the history list
and history file.
`fc'
- `fc [-e ENAME] [-nlr] [FIRST] [LAST]'
+ `fc [-e ENAME] [-lnr] [FIRST] [LAST]'
`fc -s [PAT=REP] [COMMAND]'
Fix Command. In the first form, a range of commands from FIRST to
@@ -7507,7 +7922,9 @@ available for subsequent recall. This is most useful in conjunction
with Readline.
The shell allows control of the various characters used by the
-history expansion mechanism with the `histchars' variable.
+history expansion mechanism with the `histchars' variable, as explained
+above (*note Bash Variables::). The shell uses the history comment
+character to mark history timestamps when writing the history file.
* Menu:
@@ -7629,7 +8046,7 @@ more of the following modifiers, each preceded by a `:'.
Remove a trailing pathname component, leaving only the head.
`t'
- Remove all leading pathname components, leaving the tail.
+ Remove all leading pathname components, leaving the tail.
`r'
Remove a trailing suffix of the form `.SUFFIX', leaving the
@@ -7669,7 +8086,7 @@ more of the following modifiers, each preceded by a `:'.

-File: bashref.info, Node: Installing Bash, Next: Reporting Bugs, Prev: Command Line Editing, Up: Top
+File: bashref.info, Node: Installing Bash, Next: Reporting Bugs, Prev: Using History Interactively, Up: Top
10 Installing Bash
******************
@@ -7999,7 +8416,16 @@ does not provide the necessary support.
`--enable-brace-expansion'
Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
- See *Note Brace Expansion::, for a complete description.
+ See *note Brace Expansion::, for a complete description.
+
+`--enable-casemod-attributes'
+ Include support for case-modifying attributes in the `declare'
+ builtin and assignment statements. Variables with the UPPERCASE
+ attribute, for example, will have their values converted to
+ uppercase upon assignment.
+
+`--enable-casemod-expansion'
+ Include support for case-modifying word expansions.
`--enable-command-timing'
Include support for recognizing `time' as a reserved word and for
@@ -8016,6 +8442,10 @@ does not provide the necessary support.
`=~' binary operator in the `[[' conditional command. (*note
Conditional Constructs::).
+`--enable-coprocesses'
+ Include support for coprocesses and the `coproc' reserved word
+ (*note Pipelines::).
+
`--enable-debugger'
Include support for the bash debugger (distributed separately).
@@ -8025,7 +8455,7 @@ does not provide the necessary support.
`--enable-disabled-builtins'
Allow builtin commands to be invoked via `builtin xxx' even after
- `xxx' has been disabled using `enable -n xxx'. See *Note Bash
+ `xxx' has been disabled using `enable -n xxx'. See *note Bash
Builtins::, for details of the `builtin' and `enable' builtin
commands.
@@ -8035,7 +8465,7 @@ does not provide the necessary support.
`--enable-extended-glob'
Include support for the extended pattern matching features
- described above under *Note Pattern Matching::.
+ described above under *note Pattern Matching::.
`--enable-help-builtin'
Include the `help' builtin, which displays help on shell builtins
@@ -8070,7 +8500,7 @@ does not provide the necessary support.
`--enable-prompt-string-decoding'
Turn on the interpretation of a number of backslash-escaped
characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt
- strings. See *Note Printing a Prompt::, for a complete list of
+ strings. See *note Printing a Prompt::, for a complete list of
prompt string escape sequences.
`--enable-readline'
@@ -8079,7 +8509,7 @@ does not provide the necessary support.
`--enable-restricted'
Include support for a "restricted shell". If this is enabled,
- Bash, when called as `rbash', enters a restricted mode. See *Note
+ Bash, when called as `rbash', enters a restricted mode. See *note
The Restricted Shell::, for a description of restricted mode.
`--enable-select'
@@ -8152,7 +8582,7 @@ it provides for filing a bug report.
Please send all reports concerning this manual to <chet@po.CWRU.Edu>.

-File: bashref.info, Node: Major Differences From The Bourne Shell, Next: Copying This Manual, Prev: Reporting Bugs, Up: Top
+File: bashref.info, Node: Major Differences From The Bourne Shell, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top
Appendix B Major Differences From The Bourne Shell
**************************************************
@@ -8177,8 +8607,8 @@ the baseline reference.
the `bind' builtin.
* Bash provides a programmable word completion mechanism (*note
- Programmable Completion::), and two builtin commands, `complete'
- and `compgen', to manipulate it.
+ Programmable Completion::), and builtin commands `complete',
+ `compgen', and `compopt', to manipulate it.
* Bash has command history (*note Bash History Facilities::) and the
`history' and `fc' builtins to manipulate it. The Bash history
@@ -8387,9 +8817,9 @@ the baseline reference.
Builtins::).
* Bash includes the `shopt' builtin, for finer control of shell
- optional capabilities (*note Bash Builtins::), and allows these
- options to be set and unset at shell invocation (*note Invoking
- Bash::).
+ optional capabilities (*note The Shopt Builtin::), and allows
+ these options to be set and unset at shell invocation (*note
+ Invoking Bash::).
* Bash has much more optional behavior controllable with the `set'
builtin (*note The Set Builtin::).
@@ -8470,7 +8900,7 @@ the baseline reference.
* The SVR4.2 `sh' uses a `TIMEOUT' variable like Bash uses `TMOUT'.
-More features unique to Bash may be found in *Note Bash Features::.
+More features unique to Bash may be found in *note Bash Features::.
B.1 Implementation Differences From The SVR4.2 Shell
====================================================
@@ -8516,25 +8946,15 @@ many of the limitations of the SVR4.2 shell. For instance:
turns on job control).

-File: bashref.info, Node: Copying This Manual, Next: Builtin Index, Prev: Major Differences From The Bourne Shell, Up: Top
-
-Appendix C Copying This Manual
-******************************
-
-* Menu:
-
-* GNU Free Documentation License:: License for copying this manual.
-
-
-File: bashref.info, Node: GNU Free Documentation License, Up: Copying This Manual
+File: bashref.info, Node: GNU Free Documentation License, Next: Indexes, Prev: Major Differences From The Bourne Shell, Up: Top
-C.1 GNU Free Documentation License
-==================================
+Appendix C GNU Free Documentation License
+*****************************************
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -8865,7 +9285,7 @@ C.1 GNU Free Documentation License
a storage or distribution medium, is called an "aggregate" if the
copyright resulting from the compilation is not used to limit the
legal rights of the compilation's users beyond what the individual
- works permit. When the Document is included an aggregate, this
+ works permit. When the Document is included in an aggregate, this
License does not apply to the other works in the aggregate which
are not themselves derivative works of the Document.
@@ -8926,8 +9346,8 @@ C.1 GNU Free Documentation License
you may choose any version ever published (not as a draft) by the
Free Software Foundation.
-C.1.1 ADDENDUM: How to use this License for your documents
-----------------------------------------------------------
+ADDENDUM: How to use this License for your documents
+====================================================
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and license
@@ -8937,8 +9357,8 @@ notices just after the title page:
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
- A copy of the license is included in the section entitled ``GNU
+ with no 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''.
If you have Invariant Sections, Front-Cover Texts and Back-Cover
@@ -8958,10 +9378,26 @@ free software license, such as the GNU General Public License, to
permit their use in free software.

-File: bashref.info, Node: Builtin Index, Next: Reserved Word Index, Prev: Copying This Manual, Up: Top
+File: bashref.info, Node: Indexes, Prev: GNU Free Documentation License, Up: Top
+
+Appendix D Indexes
+******************
+
+* Menu:
+
+* 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.
+
+
+File: bashref.info, Node: Builtin Index, Next: Reserved Word Index, Up: Indexes
-Index of Shell Builtin Commands
-*******************************
+D.1 Index of Shell Builtin Commands
+===================================
* Menu:
@@ -8971,31 +9407,33 @@ Index of Shell Builtin Commands
* :: Bourne Shell Builtins.
(line 11)
* [: Bourne Shell Builtins.
- (line 212)
+ (line 213)
* alias: Bash Builtins. (line 11)
* bg: Job Control Builtins.
(line 7)
* bind: Bash Builtins. (line 21)
* break: Bourne Shell Builtins.
(line 29)
-* builtin: Bash Builtins. (line 92)
-* caller: Bash Builtins. (line 100)
+* builtin: Bash Builtins. (line 98)
+* caller: Bash Builtins. (line 106)
* cd: Bourne Shell Builtins.
(line 36)
-* command: Bash Builtins. (line 117)
+* command: Bash Builtins. (line 123)
* compgen: Programmable Completion Builtins.
(line 10)
* complete: Programmable Completion Builtins.
(line 28)
+* compopt: Programmable Completion Builtins.
+ (line 213)
* continue: Bourne Shell Builtins.
(line 55)
-* declare: Bash Builtins. (line 136)
+* declare: Bash Builtins. (line 142)
* dirs: Directory Stack Builtins.
(line 7)
* disown: Job Control Builtins.
(line 83)
-* echo: Bash Builtins. (line 191)
-* enable: Bash Builtins. (line 243)
+* echo: Bash Builtins. (line 221)
+* enable: Bash Builtins. (line 273)
* eval: Bourne Shell Builtins.
(line 63)
* exec: Bourne Shell Builtins.
@@ -9012,66 +9450,67 @@ Index of Shell Builtin Commands
(line 103)
* hash: Bourne Shell Builtins.
(line 145)
-* help: Bash Builtins. (line 271)
+* help: Bash Builtins. (line 301)
* history: Bash History Builtins.
(line 39)
* jobs: Job Control Builtins.
(line 25)
* kill: Job Control Builtins.
(line 57)
-* let: Bash Builtins. (line 280)
-* local: Bash Builtins. (line 287)
-* logout: Bash Builtins. (line 297)
+* let: Bash Builtins. (line 321)
+* local: Bash Builtins. (line 328)
+* logout: Bash Builtins. (line 338)
+* mapfile: Bash Builtins. (line 342)
* popd: Directory Stack Builtins.
(line 37)
-* printf: Bash Builtins. (line 301)
+* printf: Bash Builtins. (line 383)
* pushd: Directory Stack Builtins.
(line 58)
* pwd: Bourne Shell Builtins.
(line 163)
-* read: Bash Builtins. (line 326)
+* read: Bash Builtins. (line 408)
* readonly: Bourne Shell Builtins.
(line 172)
* return: Bourne Shell Builtins.
- (line 187)
-* set: The Set Builtin. (line 9)
+ (line 188)
+* set: The Set Builtin. (line 11)
* shift: Bourne Shell Builtins.
- (line 200)
-* shopt: Bash Builtins. (line 387)
-* source: Bash Builtins. (line 618)
+ (line 201)
+* shopt: The Shopt Builtin. (line 9)
+* source: Bash Builtins. (line 480)
* suspend: Job Control Builtins.
(line 94)
* test: Bourne Shell Builtins.
- (line 212)
+ (line 213)
* times: Bourne Shell Builtins.
- (line 278)
+ (line 281)
* trap: Bourne Shell Builtins.
- (line 283)
-* type: Bash Builtins. (line 622)
-* typeset: Bash Builtins. (line 653)
-* ulimit: Bash Builtins. (line 659)
+ (line 286)
+* type: Bash Builtins. (line 484)
+* typeset: Bash Builtins. (line 515)
+* ulimit: Bash Builtins. (line 521)
* umask: Bourne Shell Builtins.
- (line 324)
-* unalias: Bash Builtins. (line 737)
+ (line 327)
+* unalias: Bash Builtins. (line 607)
* unset: Bourne Shell Builtins.
- (line 341)
+ (line 344)
* wait: Job Control Builtins.
(line 73)

-File: bashref.info, Node: Reserved Word Index, Next: Variable Index, Prev: Builtin Index, Up: Top
+File: bashref.info, Node: Reserved Word Index, Next: Variable Index, Prev: Builtin Index, Up: Indexes
-Index of Shell Reserved Words
-*****************************
+D.2 Index of Shell Reserved Words
+=================================
* Menu:
-* !: Pipelines. (line 8)
+* !: Pipelines. (line 9)
* [[: Conditional Constructs.
- (line 108)
+ (line 117)
* ]]: Conditional Constructs.
- (line 108)
+ (line 117)
* case: Conditional Constructs.
(line 28)
* do: Looping Constructs. (line 12)
@@ -9091,20 +9530,20 @@ Index of Shell Reserved Words
* in: Conditional Constructs.
(line 28)
* select: Conditional Constructs.
- (line 67)
+ (line 76)
* then: Conditional Constructs.
(line 7)
-* time: Pipelines. (line 8)
+* time: Pipelines. (line 9)
* until: Looping Constructs. (line 12)
* while: Looping Constructs. (line 20)
* {: Command Grouping. (line 21)
* }: Command Grouping. (line 21)

-File: bashref.info, Node: Variable Index, Next: Function Index, Prev: Reserved Word Index, Up: Top
+File: bashref.info, Node: Variable Index, Next: Function Index, Prev: Reserved Word Index, Up: Indexes
-Parameter and Variable Index
-****************************
+D.3 Parameter and Variable Index
+================================
* Menu:
@@ -9121,150 +9560,162 @@ Parameter and Variable Index
* auto_resume: Job Control Variables.
(line 6)
* BASH: Bash Variables. (line 13)
-* BASH_ARGC: Bash Variables. (line 16)
-* BASH_ARGV: Bash Variables. (line 26)
-* BASH_COMMAND: Bash Variables. (line 36)
-* BASH_ENV: Bash Variables. (line 41)
-* BASH_EXECUTION_STRING: Bash Variables. (line 47)
-* BASH_LINENO: Bash Variables. (line 50)
-* BASH_REMATCH: Bash Variables. (line 58)
-* BASH_SOURCE: Bash Variables. (line 66)
-* BASH_SUBSHELL: Bash Variables. (line 70)
-* BASH_VERSINFO: Bash Variables. (line 74)
-* BASH_VERSION: Bash Variables. (line 98)
+* BASH_ALIASES: Bash Variables. (line 21)
+* BASH_ARGC: Bash Variables. (line 28)
+* BASH_ARGV: Bash Variables. (line 38)
+* BASH_CMDS: Bash Variables. (line 48)
+* BASH_COMMAND: Bash Variables. (line 55)
+* BASH_ENV: Bash Variables. (line 60)
+* BASH_EXECUTION_STRING: Bash Variables. (line 66)
+* BASH_LINENO: Bash Variables. (line 69)
+* BASH_REMATCH: Bash Variables. (line 78)
+* BASH_SOURCE: Bash Variables. (line 86)
+* BASH_SUBSHELL: Bash Variables. (line 90)
+* BASH_VERSINFO: Bash Variables. (line 94)
+* BASH_VERSION: Bash Variables. (line 118)
+* BASHPID: Bash Variables. (line 16)
* bell-style: Readline Init File Syntax.
(line 38)
* bind-tty-special-chars: Readline Init File Syntax.
(line 45)
* CDPATH: Bourne Shell Variables.
(line 9)
-* COLUMNS: Bash Variables. (line 101)
+* COLUMNS: Bash Variables. (line 121)
* comment-begin: Readline Init File Syntax.
(line 50)
-* COMP_CWORD: Bash Variables. (line 106)
-* COMP_LINE: Bash Variables. (line 112)
-* COMP_POINT: Bash Variables. (line 117)
-* COMP_WORDBREAKS: Bash Variables. (line 125)
-* COMP_WORDS: Bash Variables. (line 131)
-* completion-query-items: Readline Init File Syntax.
+* COMP_CWORD: Bash Variables. (line 126)
+* COMP_KEY: Bash Variables. (line 155)
+* COMP_LINE: Bash Variables. (line 132)
+* COMP_POINT: Bash Variables. (line 137)
+* COMP_TYPE: Bash Variables. (line 145)
+* COMP_WORDBREAKS: Bash Variables. (line 159)
+* COMP_WORDS: Bash Variables. (line 165)
+* completion-prefix-display-length: Readline Init File Syntax.
(line 60)
-* COMPREPLY: Bash Variables. (line 138)
+* completion-query-items: Readline Init File Syntax.
+ (line 67)
+* COMPREPLY: Bash Variables. (line 172)
* convert-meta: Readline Init File Syntax.
- (line 70)
-* DIRSTACK: Bash Variables. (line 143)
+ (line 77)
+* DIRSTACK: Bash Variables. (line 177)
* disable-completion: Readline Init File Syntax.
- (line 76)
+ (line 83)
* editing-mode: Readline Init File Syntax.
- (line 81)
-* EMACS: Bash Variables. (line 153)
+ (line 88)
+* EMACS: Bash Variables. (line 187)
* enable-keypad: Readline Init File Syntax.
- (line 87)
-* EUID: Bash Variables. (line 158)
+ (line 94)
+* EUID: Bash Variables. (line 192)
* expand-tilde: Readline Init File Syntax.
- (line 92)
-* FCEDIT: Bash Variables. (line 162)
-* FIGNORE: Bash Variables. (line 166)
-* FUNCNAME: Bash Variables. (line 172)
-* GLOBIGNORE: Bash Variables. (line 181)
-* GROUPS: Bash Variables. (line 187)
-* histchars: Bash Variables. (line 193)
-* HISTCMD: Bash Variables. (line 208)
-* HISTCONTROL: Bash Variables. (line 213)
-* HISTFILE: Bash Variables. (line 229)
-* HISTFILESIZE: Bash Variables. (line 233)
-* HISTIGNORE: Bash Variables. (line 241)
+ (line 99)
+* FCEDIT: Bash Variables. (line 196)
+* FIGNORE: Bash Variables. (line 200)
+* FUNCNAME: Bash Variables. (line 206)
+* GLOBIGNORE: Bash Variables. (line 215)
+* GROUPS: Bash Variables. (line 221)
+* histchars: Bash Variables. (line 227)
+* HISTCMD: Bash Variables. (line 242)
+* HISTCONTROL: Bash Variables. (line 247)
+* HISTFILE: Bash Variables. (line 263)
+* HISTFILESIZE: Bash Variables. (line 267)
+* HISTIGNORE: Bash Variables. (line 275)
* history-preserve-point: Readline Init File Syntax.
- (line 96)
-* HISTSIZE: Bash Variables. (line 260)
-* HISTTIMEFORMAT: Bash Variables. (line 264)
+ (line 103)
+* history-size: Readline Init File Syntax.
+ (line 109)
+* HISTSIZE: Bash Variables. (line 294)
+* HISTTIMEFORMAT: Bash Variables. (line 298)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
- (line 101)
-* HOSTFILE: Bash Variables. (line 271)
-* HOSTNAME: Bash Variables. (line 282)
-* HOSTTYPE: Bash Variables. (line 285)
+ (line 114)
+* HOSTFILE: Bash Variables. (line 307)
+* HOSTNAME: Bash Variables. (line 318)
+* HOSTTYPE: Bash Variables. (line 321)
* IFS: Bourne Shell Variables.
(line 18)
-* IGNOREEOF: Bash Variables. (line 288)
+* IGNOREEOF: Bash Variables. (line 324)
* input-meta: Readline Init File Syntax.
- (line 108)
-* INPUTRC: Bash Variables. (line 298)
+ (line 121)
+* INPUTRC: Bash Variables. (line 334)
* isearch-terminators: Readline Init File Syntax.
- (line 115)
+ (line 128)
* keymap: Readline Init File Syntax.
- (line 122)
-* LANG: Bash Variables. (line 302)
-* LC_ALL: Bash Variables. (line 306)
-* LC_COLLATE: Bash Variables. (line 310)
-* LC_CTYPE: Bash Variables. (line 317)
+ (line 135)
+* LANG: Bash Variables. (line 338)
+* LC_ALL: Bash Variables. (line 342)
+* LC_COLLATE: Bash Variables. (line 346)
+* LC_CTYPE: Bash Variables. (line 353)
* LC_MESSAGES <1>: Locale Translation. (line 11)
-* LC_MESSAGES: Bash Variables. (line 322)
-* LC_NUMERIC: Bash Variables. (line 326)
-* LINENO: Bash Variables. (line 330)
-* LINES: Bash Variables. (line 334)
-* MACHTYPE: Bash Variables. (line 339)
+* LC_MESSAGES: Bash Variables. (line 358)
+* LC_NUMERIC: Bash Variables. (line 362)
+* LINENO: Bash Variables. (line 366)
+* LINES: Bash Variables. (line 370)
+* MACHTYPE: Bash Variables. (line 375)
* MAIL: Bourne Shell Variables.
(line 22)
-* MAILCHECK: Bash Variables. (line 343)
+* MAILCHECK: Bash Variables. (line 379)
* MAILPATH: Bourne Shell Variables.
(line 27)
* mark-modified-lines: Readline Init File Syntax.
- (line 135)
+ (line 148)
* mark-symlinked-directories: Readline Init File Syntax.
- (line 140)
+ (line 153)
* match-hidden-files: Readline Init File Syntax.
- (line 145)
+ (line 158)
* meta-flag: Readline Init File Syntax.
- (line 108)
-* OLDPWD: Bash Variables. (line 351)
+ (line 121)
+* OLDPWD: Bash Variables. (line 387)
* OPTARG: Bourne Shell Variables.
(line 34)
-* OPTERR: Bash Variables. (line 354)
+* OPTERR: Bash Variables. (line 390)
* OPTIND: Bourne Shell Variables.
(line 38)
-* OSTYPE: Bash Variables. (line 358)
+* OSTYPE: Bash Variables. (line 394)
* output-meta: Readline Init File Syntax.
- (line 152)
+ (line 165)
* page-completions: Readline Init File Syntax.
- (line 157)
+ (line 170)
* PATH: Bourne Shell Variables.
(line 42)
-* PIPESTATUS: Bash Variables. (line 361)
-* POSIXLY_CORRECT: Bash Variables. (line 366)
-* PPID: Bash Variables. (line 375)
-* PROMPT_COMMAND: Bash Variables. (line 379)
+* PIPESTATUS: Bash Variables. (line 397)
+* POSIXLY_CORRECT: Bash Variables. (line 402)
+* PPID: Bash Variables. (line 411)
+* PROMPT_COMMAND: Bash Variables. (line 415)
+* PROMPT_DIRTRIM: Bash Variables. (line 419)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
-* PS3: Bash Variables. (line 383)
-* PS4: Bash Variables. (line 388)
-* PWD: Bash Variables. (line 394)
-* RANDOM: Bash Variables. (line 397)
-* REPLY: Bash Variables. (line 402)
-* SECONDS: Bash Variables. (line 405)
-* SHELL: Bash Variables. (line 411)
-* SHELLOPTS: Bash Variables. (line 416)
-* SHLVL: Bash Variables. (line 425)
+* PS3: Bash Variables. (line 425)
+* PS4: Bash Variables. (line 430)
+* PWD: Bash Variables. (line 436)
+* RANDOM: Bash Variables. (line 439)
+* REPLY: Bash Variables. (line 444)
+* revert-all-at-newline: Readline Init File Syntax.
+ (line 180)
+* SECONDS: Bash Variables. (line 447)
+* SHELL: Bash Variables. (line 453)
+* SHELLOPTS: Bash Variables. (line 458)
+* SHLVL: Bash Variables. (line 467)
* show-all-if-ambiguous: Readline Init File Syntax.
- (line 167)
+ (line 186)
* show-all-if-unmodified: Readline Init File Syntax.
- (line 173)
+ (line 192)
* TEXTDOMAIN: Locale Translation. (line 11)
* TEXTDOMAINDIR: Locale Translation. (line 11)
-* TIMEFORMAT: Bash Variables. (line 430)
-* TMOUT: Bash Variables. (line 468)
-* TMPDIR: Bash Variables. (line 480)
-* UID: Bash Variables. (line 484)
+* TIMEFORMAT: Bash Variables. (line 472)
+* TMOUT: Bash Variables. (line 510)
+* TMPDIR: Bash Variables. (line 522)
+* UID: Bash Variables. (line 526)
* visible-stats: Readline Init File Syntax.
- (line 182)
+ (line 201)

-File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Top
+File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
-Function Index
-**************
+D.4 Function Index
+==================
* Menu:
@@ -9285,16 +9736,16 @@ Function Index
(line 41)
* character-search-backward (M-C-]): Miscellaneous Commands.
(line 46)
-* clear-screen (C-l): Commands For Moving. (line 26)
+* clear-screen (C-l): Commands For Moving. (line 34)
* complete (<TAB>): Commands For Completion.
(line 6)
-* copy-backward-word (): Commands For Killing. (line 49)
-* copy-forward-word (): Commands For Killing. (line 54)
-* copy-region-as-kill (): Commands For Killing. (line 45)
+* copy-backward-word (): Commands For Killing. (line 58)
+* copy-forward-word (): Commands For Killing. (line 63)
+* copy-region-as-kill (): Commands For Killing. (line 54)
* delete-char (C-d): Commands For Text. (line 6)
* delete-char-or-list (): Commands For Completion.
(line 34)
-* delete-horizontal-space (): Commands For Killing. (line 37)
+* delete-horizontal-space (): Commands For Killing. (line 46)
* digit-argument (M-0, M-1, ... M--): Numeric Arguments. (line 6)
* do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
(line 14)
@@ -9321,7 +9772,7 @@ Function Index
* insert-completions (M-*): Commands For Completion.
(line 18)
* kill-line (C-k): Commands For Killing. (line 6)
-* kill-region (): Commands For Killing. (line 41)
+* kill-region (): Commands For Killing. (line 50)
* kill-whole-line (): Commands For Killing. (line 15)
* kill-word (M-d): Commands For Killing. (line 19)
* menu-complete (): Commands For Completion.
@@ -9340,7 +9791,7 @@ Function Index
* quoted-insert (C-q or C-v): Commands For Text. (line 20)
* re-read-init-file (C-x C-r): Miscellaneous Commands.
(line 6)
-* redraw-current-line (): Commands For Moving. (line 30)
+* redraw-current-line (): Commands For Moving. (line 38)
* reverse-search-history (C-r): Commands For History. (line 27)
* revert-line (M-r): Miscellaneous Commands.
(line 25)
@@ -9353,20 +9804,20 @@ Function Index
* undo (C-_ or C-x C-u): Miscellaneous Commands.
(line 22)
* universal-argument (): Numeric Arguments. (line 10)
-* unix-filename-rubout (): Commands For Killing. (line 32)
+* unix-filename-rubout (): Commands For Killing. (line 41)
* unix-line-discard (C-u): Commands For Killing. (line 12)
-* unix-word-rubout (C-w): Commands For Killing. (line 28)
+* unix-word-rubout (C-w): Commands For Killing. (line 37)
* upcase-word (M-u): Commands For Text. (line 38)
-* yank (C-y): Commands For Killing. (line 59)
+* yank (C-y): Commands For Killing. (line 68)
* yank-last-arg (M-. or M-_): Commands For History. (line 65)
* yank-nth-arg (M-C-y): Commands For History. (line 56)
-* yank-pop (M-y): Commands For Killing. (line 62)
+* yank-pop (M-y): Commands For Killing. (line 71)

-File: bashref.info, Node: Concept Index, Prev: Function Index, Up: Top
+File: bashref.info, Node: Concept Index, Prev: Function Index, Up: Indexes
-Concept Index
-*************
+D.5 Concept Index
+=================
* Menu:
@@ -9396,7 +9847,7 @@ Concept Index
(line 6)
* command substitution: Command Substitution.
(line 6)
-* command timing: Pipelines. (line 8)
+* command timing: Pipelines. (line 9)
* commands, compound: Compound Commands. (line 6)
* commands, conditional: Conditional Constructs.
(line 6)
@@ -9411,6 +9862,7 @@ Concept Index
(line 6)
* configuration: Basic Installation. (line 6)
* control operator: Definitions. (line 21)
+* coprocess: Coprocesses. (line 6)
* directory stack: The Directory Stack. (line 6)
* editing command lines: Readline Bare Essentials.
(line 6)
@@ -9420,7 +9872,7 @@ Concept Index
* execution environment: Command Execution Environment.
(line 6)
* exit status <1>: Exit Status. (line 6)
-* exit status: Definitions. (line 25)
+* exit status: Definitions. (line 26)
* expansion: Shell Expansions. (line 6)
* expansion, arithmetic: Arithmetic Expansion.
(line 6)
@@ -9433,10 +9885,8 @@ Concept Index
* expressions, arithmetic: Shell Arithmetic. (line 6)
* expressions, conditional: Bash Conditional Expressions.
(line 6)
-* FDL, GNU Free Documentation License: GNU Free Documentation License.
- (line 6)
-* field: Definitions. (line 29)
-* filename: Definitions. (line 34)
+* field: Definitions. (line 30)
+* filename: Definitions. (line 35)
* filename expansion: Filename Expansion. (line 9)
* foreground: Job Control Basics. (line 6)
* functions, shell: Shell Functions. (line 6)
@@ -9447,8 +9897,8 @@ Concept Index
* history list: Bash History Facilities.
(line 6)
* History, how to use: Programmable Completion Builtins.
- (line 209)
-* identifier: Definitions. (line 50)
+ (line 225)
+* identifier: Definitions. (line 51)
* initialization file, readline: Readline Init File. (line 6)
* installation: Basic Installation. (line 6)
* interaction, readline: Readline Interaction.
@@ -9456,9 +9906,9 @@ Concept Index
* interactive shell <1>: Interactive Shells. (line 6)
* interactive shell: Invoking Bash. (line 127)
* internationalization: Locale Translation. (line 6)
-* job: Definitions. (line 37)
-* job control <1>: Definitions. (line 41)
-* job control: Job Control Basics. (line 6)
+* job: Definitions. (line 38)
+* job control <1>: Job Control Basics. (line 6)
+* job control: Definitions. (line 42)
* kill ring: Readline Killing Commands.
(line 19)
* killing text: Readline Killing Commands.
@@ -9466,12 +9916,12 @@ Concept Index
* localization: Locale Translation. (line 6)
* login shell: Invoking Bash. (line 124)
* matching, pattern: Pattern Matching. (line 6)
-* metacharacter: Definitions. (line 45)
-* name: Definitions. (line 50)
+* metacharacter: Definitions. (line 46)
+* name: Definitions. (line 51)
* native languages: Locale Translation. (line 6)
* notation, readline: Readline Bare Essentials.
(line 6)
-* operator, shell: Definitions. (line 56)
+* operator, shell: Definitions. (line 57)
* parameter expansion: Shell Parameter Expansion.
(line 6)
* parameters: Shell Parameters. (line 6)
@@ -9483,8 +9933,8 @@ Concept Index
* pipeline: Pipelines. (line 6)
* POSIX: Definitions. (line 9)
* POSIX Mode: Bash POSIX Mode. (line 6)
-* process group: Definitions. (line 60)
-* process group ID: Definitions. (line 64)
+* process group: Definitions. (line 62)
+* process group ID: Definitions. (line 66)
* process substitution: Process Substitution.
(line 6)
* programmable completion: Programmable Completion.
@@ -9495,28 +9945,28 @@ Concept Index
* Readline, how to use: Job Control Variables.
(line 24)
* redirection: Redirections. (line 6)
-* reserved word: Definitions. (line 68)
+* reserved word: Definitions. (line 70)
* restricted shell: The Restricted Shell.
(line 6)
-* return status: Definitions. (line 73)
+* return status: Definitions. (line 75)
* shell arithmetic: Shell Arithmetic. (line 6)
* shell function: Shell Functions. (line 6)
* shell script: Shell Scripts. (line 6)
* shell variable: Shell Parameters. (line 6)
* shell, interactive: Interactive Shells. (line 6)
-* signal: Definitions. (line 76)
+* signal: Definitions. (line 78)
* signal handling: Signals. (line 6)
-* special builtin <1>: Definitions. (line 80)
-* special builtin: Special Builtins. (line 6)
+* special builtin <1>: Special Builtins. (line 6)
+* special builtin: Definitions. (line 82)
* startup files: Bash Startup Files. (line 6)
* suspending jobs: Job Control Basics. (line 6)
* tilde expansion: Tilde Expansion. (line 6)
-* token: Definitions. (line 84)
+* token: Definitions. (line 86)
* translation, native languages: Locale Translation. (line 6)
* variable, shell: Shell Parameters. (line 6)
* variables, readline: Readline Init File Syntax.
(line 37)
-* word: Definitions. (line 88)
+* word: Definitions. (line 90)
* word splitting: Word Splitting. (line 6)
* yanking text: Readline Killing Commands.
(line 6)
@@ -9524,129 +9974,132 @@ Concept Index

Tag Table:
-Node: Top1359
-Node: Introduction3442
-Node: What is Bash?3670
-Node: What is a shell?4783
-Node: Definitions7324
-Node: Basic Shell Features10091
-Node: Shell Syntax11310
-Node: Shell Operation12340
-Node: Quoting13634
-Node: Escape Character14937
-Node: Single Quotes15422
-Node: Double Quotes15770
-Node: ANSI-C Quoting16895
-Node: Locale Translation17851
-Node: Comments18747
-Node: Shell Commands19361
-Node: Simple Commands20127
-Node: Pipelines20758
-Node: Lists22633
-Node: Compound Commands24264
-Node: Looping Constructs25048
-Node: Conditional Constructs27495
-Node: Command Grouping34954
-Node: Shell Functions36403
-Node: Shell Parameters40812
-Node: Positional Parameters43142
-Node: Special Parameters44042
-Node: Shell Expansions47006
-Node: Brace Expansion48931
-Node: Tilde Expansion51256
-Node: Shell Parameter Expansion53607
-Node: Command Substitution61077
-Node: Arithmetic Expansion62410
-Node: Process Substitution63260
-Node: Word Splitting64310
-Node: Filename Expansion65771
-Node: Pattern Matching67907
-Node: Quote Removal71225
-Node: Redirections71520
-Node: Executing Commands79250
-Node: Simple Command Expansion79920
-Node: Command Search and Execution81850
-Node: Command Execution Environment83856
-Node: Environment86627
-Node: Exit Status88287
-Node: Signals89491
-Node: Shell Scripts91455
-Node: Shell Builtin Commands93973
-Node: Bourne Shell Builtins95642
-Node: Bash Builtins112744
-Node: The Set Builtin142004
-Node: Special Builtins150379
-Node: Shell Variables151349
-Node: Bourne Shell Variables151789
-Node: Bash Variables153770
-Node: Bash Features174084
-Node: Invoking Bash174967
-Node: Bash Startup Files180776
-Node: Interactive Shells185634
-Node: What is an Interactive Shell?186044
-Node: Is this Shell Interactive?186694
-Node: Interactive Shell Behavior187509
-Node: Bash Conditional Expressions190785
-Node: Shell Arithmetic194364
-Node: Aliases197110
-Node: Arrays199678
-Node: The Directory Stack203027
-Node: Directory Stack Builtins203741
-Node: Printing a Prompt206632
-Node: The Restricted Shell209346
-Node: Bash POSIX Mode211178
-Node: Job Control218937
-Node: Job Control Basics219404
-Node: Job Control Builtins223780
-Node: Job Control Variables228107
-Node: Command Line Editing229265
-Node: Introduction and Notation230264
-Node: Readline Interaction231886
-Node: Readline Bare Essentials233077
-Node: Readline Movement Commands234866
-Node: Readline Killing Commands235831
-Node: Readline Arguments237751
-Node: Searching238795
-Node: Readline Init File240981
-Node: Readline Init File Syntax242128
-Node: Conditional Init Constructs254459
-Node: Sample Init File256992
-Node: Bindable Readline Commands260109
-Node: Commands For Moving261316
-Node: Commands For History262177
-Node: Commands For Text265332
-Node: Commands For Killing268005
-Node: Numeric Arguments270147
-Node: Commands For Completion271286
-Node: Keyboard Macros274879
-Node: Miscellaneous Commands275450
-Node: Readline vi Mode280761
-Node: Programmable Completion281675
-Node: Programmable Completion Builtins287467
-Node: Using History Interactively295063
-Node: Bash History Facilities295743
-Node: Bash History Builtins298438
-Node: History Interaction302295
-Node: Event Designators304851
-Node: Word Designators305866
-Node: Modifiers307505
-Node: Installing Bash308911
-Node: Basic Installation310041
-Node: Compilers and Options312733
-Node: Compiling For Multiple Architectures313474
-Node: Installation Names315138
-Node: Specifying the System Type315956
-Node: Sharing Defaults316672
-Node: Operation Controls317345
-Node: Optional Features318303
-Node: Reporting Bugs327234
-Node: Major Differences From The Bourne Shell328428
-Node: Copying This Manual345093
-Node: GNU Free Documentation License345369
-Node: Builtin Index367775
-Node: Reserved Word Index374324
-Node: Variable Index376760
-Node: Function Index387693
-Node: Concept Index394413
+Node: Top1344
+Node: Introduction3181
+Node: What is Bash?3409
+Node: What is a shell?4522
+Node: Definitions7062
+Node: Basic Shell Features9980
+Node: Shell Syntax11199
+Node: Shell Operation12229
+Node: Quoting13523
+Node: Escape Character14826
+Node: Single Quotes15311
+Node: Double Quotes15659
+Node: ANSI-C Quoting16784
+Node: Locale Translation17740
+Node: Comments18636
+Node: Shell Commands19254
+Node: Simple Commands20078
+Node: Pipelines20709
+Node: Lists22965
+Node: Compound Commands24694
+Node: Looping Constructs25498
+Node: Conditional Constructs27945
+Node: Command Grouping35951
+Node: Coprocesses37430
+Node: Shell Functions38919
+Node: Shell Parameters43380
+Node: Positional Parameters45796
+Node: Special Parameters46696
+Node: Shell Expansions49660
+Node: Brace Expansion51585
+Node: Tilde Expansion54338
+Node: Shell Parameter Expansion56689
+Node: Command Substitution65520
+Node: Arithmetic Expansion66853
+Node: Process Substitution67703
+Node: Word Splitting68753
+Node: Filename Expansion70376
+Node: Pattern Matching72516
+Node: Quote Removal76155
+Node: Redirections76450
+Node: Executing Commands84593
+Node: Simple Command Expansion85263
+Node: Command Search and Execution87193
+Node: Command Execution Environment89530
+Node: Environment92329
+Node: Exit Status93989
+Node: Signals95610
+Node: Shell Scripts97578
+Node: Shell Builtin Commands100096
+Node: Bourne Shell Builtins101773
+Node: Bash Builtins119091
+Node: Modifying Shell Behavior142764
+Node: The Set Builtin143109
+Node: The Shopt Builtin152149
+Node: Special Builtins163011
+Node: Shell Variables163990
+Node: Bourne Shell Variables164430
+Node: Bash Variables166411
+Node: Bash Features188729
+Node: Invoking Bash189612
+Node: Bash Startup Files195421
+Node: Interactive Shells200390
+Node: What is an Interactive Shell?200800
+Node: Is this Shell Interactive?201449
+Node: Interactive Shell Behavior202264
+Node: Bash Conditional Expressions205544
+Node: Shell Arithmetic209123
+Node: Aliases211869
+Node: Arrays214441
+Node: The Directory Stack218283
+Node: Directory Stack Builtins218997
+Node: Printing a Prompt221889
+Node: The Restricted Shell224641
+Node: Bash POSIX Mode226473
+Node: Job Control234326
+Node: Job Control Basics234786
+Node: Job Control Builtins239399
+Node: Job Control Variables243763
+Node: Command Line Editing244921
+Node: Introduction and Notation246488
+Node: Readline Interaction248110
+Node: Readline Bare Essentials249301
+Node: Readline Movement Commands251090
+Node: Readline Killing Commands252055
+Node: Readline Arguments253975
+Node: Searching255019
+Node: Readline Init File257205
+Node: Readline Init File Syntax258352
+Node: Conditional Init Constructs271586
+Node: Sample Init File274119
+Node: Bindable Readline Commands277236
+Node: Commands For Moving278443
+Node: Commands For History279587
+Node: Commands For Text282742
+Node: Commands For Killing285415
+Node: Numeric Arguments287866
+Node: Commands For Completion289005
+Node: Keyboard Macros292772
+Node: Miscellaneous Commands293343
+Node: Readline vi Mode298654
+Node: Programmable Completion299568
+Node: Programmable Completion Builtins305401
+Node: Using History Interactively313827
+Node: Bash History Facilities314511
+Node: Bash History Builtins317425
+Node: History Interaction321282
+Node: Event Designators323987
+Node: Word Designators325002
+Node: Modifiers326641
+Node: Installing Bash328045
+Node: Basic Installation329182
+Node: Compilers and Options331874
+Node: Compiling For Multiple Architectures332615
+Node: Installation Names334279
+Node: Specifying the System Type335097
+Node: Sharing Defaults335813
+Node: Operation Controls336486
+Node: Optional Features337444
+Node: Reporting Bugs346846
+Node: Major Differences From The Bourne Shell348040
+Node: GNU Free Documentation License364727
+Node: Indexes387188
+Node: Builtin Index387642
+Node: Reserved Word Index394396
+Node: Variable Index396844
+Node: Function Index408650
+Node: Concept Index415382

End Tag Table
diff --git a/doc/bashref.texi b/doc/bashref.texi
index c2892d63..3f60390b 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -16,7 +16,7 @@ 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.
+Copyright @copyright{} 1988--2009 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -26,13 +26,14 @@ are preserved on all copies.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
-Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
+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.''
+included in the section entitled ``GNU Free Documentation License''.
+
+(a) The FSF's Back-Cover Text is: You are free to copy and modify
+this GNU manual. Buying copies from GNU Press supports the FSF in
+developing GNU and promoting software freedom.''
-(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.''
@end quotation
@end copying
@@ -102,22 +103,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
@@ -164,7 +159,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
@@ -231,10 +226,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
@@ -280,6 +275,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
@@ -288,7 +284,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
@@ -313,12 +309,13 @@ A shell builtin command that has been classified as special by the
@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
@@ -562,7 +559,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}
@@ -589,6 +586,7 @@ some other grouping.
commands.
* Lists:: How to execute commands sequentially.
* Compound Commands:: Shell commands for control flow.
+* Coprocesses:: Two-way communication between commands.
@end menu
@node Simple Commands
@@ -611,21 +609,28 @@ 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{}]
+[@code{time} [@code{-p}]] [@code{!}] @var{command1} [ [@code{|} or @code{|&}] @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, the standard error of @var{command1} 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 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.
@@ -686,8 +691,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}
@@ -848,20 +856,23 @@ The syntax of the @code{case} command is:
@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.
Here is an example using @code{case} in a script that could be used to
@@ -880,6 +891,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.
@@ -897,7 +917,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
@@ -960,7 +980,7 @@ 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}.
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 (@samp{==}) or does not
@@ -977,9 +997,11 @@ 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 it 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
@@ -1047,13 +1069,54 @@ 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
+@code{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}.
+
+When the coproc is executed, the shell creates an array variable
+(@pxref{Arrays})
+named @var{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 @var{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 @var{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 process id of the shell spawned to execute the coprocess is
+available as the value of the variable @var{NAME}_PID.
+The @code{wait}
+builtin command may be used to wait for the coprocess to terminate.
+
+The return status of a coprocess is the exit status of @var{command}.
+
@node Shell Functions
@section Shell Functions
@cindex shell function
@@ -1098,7 +1161,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.
@@ -1213,7 +1277,8 @@ 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.
@@ -1377,7 +1442,7 @@ This mechanism is similar to
@var{filename expansion} (@pxref{Filename Expansion}),
but the file names 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 seqeunce expression
between a pair of braces,
followed by an optional @var{postscript}.
The preamble is prefixed to each string contained within the braces, and
@@ -1393,13 +1458,20 @@ 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.
+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
@@ -1591,20 +1663,27 @@ 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}.
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}
+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.
+Substring expansion applied to an associative array produces undefined
+results.
+
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the @samp{:-} expansion.
Substring indexing is zero-based unless the positional parameters
-are used, in which case the indexing starts at 1.
+are used, in which case the indexing starts at 1 by default.
+If @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}[*]@}
@@ -1678,6 +1757,29 @@ 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
+pathname expansion.
+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.
+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
@@ -1781,13 +1883,15 @@ 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 on these characters.
+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
@@ -1840,7 +1944,7 @@ When matching a file name, 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.
@@ -1878,6 +1982,12 @@ 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{}]
@@ -2080,11 +2190,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:
@@ -2103,6 +2213,23 @@ This is semantically equivalent to
>@var{word} 2>&1
@end example
+@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
+
@subsection Here Documents
This type of redirection instructs the shell to read input from the
current source until a line containing only @var{word}
@@ -2293,7 +2420,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
@@ -2351,7 +2483,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})
@@ -2402,6 +2534,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
@@ -2449,6 +2585,14 @@ command in its environment.
@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.
@@ -2508,7 +2652,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
@@ -2588,8 +2732,8 @@ 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.
@end menu
@@ -2717,7 +2861,7 @@ exec [-cl] [-a @var{name}] [@var{command} [@var{arguments}]]
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.
@@ -2851,13 +2995,15 @@ is supplied.
@item readonly
@btindex readonly
@example
-readonly [-apf] [@var{name}[=@var{value}]] @dots{}
+readonly [-aApf] [@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 no @var{name} arguments are given, or if the @option{-p}
option is supplied, a list of all readonly names is printed.
The @option{-p} option causes output to be displayed in a format that
@@ -2892,8 +3038,9 @@ 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.
@@ -2917,6 +3064,7 @@ 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.
@table @code
@item ! @var{expr}
@@ -2957,14 +3105,14 @@ 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
@@ -3014,7 +3162,7 @@ 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
+@code{shopt} builtin (@pxref{The Shopt Builtin}) for details of its
effect on the @code{DEBUG} trap.
If a @var{sigspec} is @code{ERR}, the command @var{arg}
is executed whenever a simple command has a non-zero exit status,
@@ -3022,7 +3170,8 @@ 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 a command executed in a @code{&&} or @code{||} list,
+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
@@ -3110,9 +3259,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
-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
@@ -3171,7 +3321,13 @@ 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.
@end table
@noindent
@@ -3238,7 +3394,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 [-aAfFilrtux] [-p] [@var{name}[=@var{value}] @dots{}]
@end example
Declare variables and give them attributes. If no @var{name}s
@@ -3246,11 +3402,20 @@ 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
+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 following options can be used to restrict output to variables with
@@ -3258,7 +3423,10 @@ 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.
@@ -3268,6 +3436,11 @@ 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 -r
Make @var{name}s readonly. These names cannot then be assigned values
by subsequent assignment statements or unset.
@@ -3278,12 +3451,20 @@ 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}.
@@ -3323,7 +3504,7 @@ alert (bell)
@item \b
backspace
@item \c
-suppress trailing newline
+suppress further output
@item \e
escape
@item \f
@@ -3349,7 +3530,7 @@ the eight-bit character whose value is the hexadecimal value @var{HH}
@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
@@ -3381,14 +3562,24 @@ 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
@@ -3424,10 +3615,50 @@ logout [@var{n}]
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 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 line 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.
+
+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, or @var{array} is invalid or unassignable.
+
@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}.
@@ -3457,7 +3688,7 @@ 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}] [-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
@@ -3473,8 +3704,9 @@ 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), or an
+invalid file descriptor is supplied as the argument to @option{-u}.
+
Options, if supplied, have the following meanings:
@table @code
@@ -3490,6 +3722,12 @@ 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
@@ -3513,275 +3751,20 @@ 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.
+@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 @var{timeout} is 0, @code{read} returns success if input is available on
+the specified file descriptor, failure otherwise.
+The exit status is greater than 128 if the timeout is exceeded.
@item -u @var{fd}
Read input from file descriptor @var{fd}.
@end table
-@item shopt
-@btindex shopt
-@example
-shopt [-pqsu] [-o] [@var{optname} @dots{}]
-@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 compat31
-If set, Bash
-changes its behavior to that of version 3.1 with respect to quoted
-arguments to the conditional command's =~ operator.
-
-@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
-
-@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.
-
@item source
@btindex source
@example
@@ -3823,8 +3806,8 @@ 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
@@ -3838,7 +3821,7 @@ builtin command.
@item ulimit
@btindex ulimit
@example
-ulimit [-acdefilmnpqrstuvxSH] [@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
@@ -3853,6 +3836,9 @@ Change and report the hard limit associated with a resource.
@item -a
All current limits are reported.
+@item -b
+The maximum socket buffer size.
+
@item -c
The maximum size of core files created.
@@ -3901,12 +3887,17 @@ The maximum amount of virtual memory available to the process.
@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
@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,
@@ -3931,16 +3922,28 @@ 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}] [@var{argument} @dots{}]
+set [+abefhkmnptuvxBCEHPT] [+o @var{option}] [@var{argument} @dots{}]
@end example
If no options or arguments are supplied, @code{set} displays the names
@@ -3965,10 +3968,14 @@ 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{!}.
+command list immediately following a @code{while} or @code{until} keyword,
+part of the test in an @code{if} statement,
+part of a command executed in a @code{&&} or @code{||b} list,
+any command in a pipeline but the last,
+or if the command's return status is being inverted using @code{!}.
+Failing simple commands that are part of shell functions or command lists
+enclosed in braces or parentheses satisfying the above conditions do not
+cause the shell to exit.
A trap on @code{ERR}, if set, is executed before the shell exits.
@item -f
@@ -4004,6 +4011,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}.
@@ -4078,6 +4086,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}.
@@ -4087,8 +4096,8 @@ 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{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
are taken and the effective user id is set to the real user id.
@@ -4188,6 +4197,299 @@ 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 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 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 =~ operator.
+
+@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{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 globstar
+If set, the pattern @samp{**} used in a filename expansion context will
+match a 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 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
+
+@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
@@ -4307,6 +4609,18 @@ variables for controlling the job control facilities
@item BASH
The full pathname used to execute the current instance of Bash.
+@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
@@ -4315,7 +4629,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).
@@ -4326,10 +4640,17 @@ 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,
@@ -4347,7 +4668,8 @@ The command argument to the @option{-c} invocation option.
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.
+@code{$@{FUNCNAME[$i]@}} was called (or @code{$@{BASH_LINENO[$i-1]@}} if
+referenced within another shell function).
The corresponding source file name is @code{$@{BASH_SOURCE[$i]@}}.
Use @code{LINENO} to obtain the current line number.
@@ -4425,6 +4747,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.
@@ -4481,7 +4820,7 @@ An array variable containing the names of all shell functions
currently in the execution call stack.
The element with index 0 is the name of any currently-executing
shell function.
-The bottom-most element is "main".
+The bottom-most element is @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
@@ -4583,6 +4922,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
@@ -4699,6 +5040,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{Printing a 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
@@ -4801,7 +5148,7 @@ 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
+In an interactive shell, the value is interpreted as
the number of seconds to wait for input after issuing the primary
prompt when the shell is interactive.
Bash terminates after that number of seconds if input does
@@ -4855,7 +5202,7 @@ 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}
@@ -4871,7 +5218,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}
@@ -4958,7 +5305,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
@@ -5000,7 +5347,7 @@ 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
Tilde Expansion (@pxref{Tilde Expansion}).
@@ -5089,9 +5436,11 @@ 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 a network connection, as if 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
@@ -5125,7 +5474,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.
@@ -5218,7 +5567,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
@@ -5257,7 +5606,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
@@ -5541,7 +5890,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
@@ -5568,14 +5917,18 @@ 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.
-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}
@end example
@@ -5593,7 +5946,14 @@ 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.
+
+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.
@@ -5604,10 +5964,15 @@ name=(value@var{1} @dots{} value@var{n})
@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 the bracket and subscript.
+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.
@@ -5636,7 +6001,7 @@ expansion of the special parameters @samp{@@} and @samp{*}.
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.
The @code{unset} builtin is used to destroy arrays.
@code{unset} @var{name}[@var{subscript}]
@@ -5648,9 +6013,9 @@ 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.
+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}
@@ -5739,7 +6104,7 @@ from the stack, so that only the stack is manipulated.
@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
@@ -5747,6 +6112,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
@@ -5755,9 +6123,6 @@ 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}'.
@@ -5819,7 +6184,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 \!
@@ -6105,7 +6471,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
@@ -6113,6 +6479,10 @@ 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.
+
@end enumerate
There is other @sc{posix} behavior that Bash does not implement by
@@ -6208,7 +6578,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
@@ -6216,9 +6586,11 @@ 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
@@ -6243,11 +6615,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
@@ -6374,8 +6748,9 @@ argument restricts operation to running jobs.
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.
+@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
@@ -6772,6 +7147,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}
@@ -6787,6 +7170,10 @@ Include support for matching 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).
@@ -6962,8 +7349,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
@@ -7230,7 +7618,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
@@ -7395,33 +7783,42 @@ 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
diff --git a/doc/builtins.1 b/doc/builtins.1
index 6a0b2483..bf8bfec2 100644
--- a/doc/builtins.1
+++ b/doc/builtins.1
@@ -1,12 +1,14 @@
.\" This is a hack to force bash builtins into the whatis database
.\" and to get the list of builtins to come up with the man command.
-.TH BASH_BUILTINS 1 "2004 Apr 20" "GNU Bash-3.0"
+.TH BASH_BUILTINS 1 "2004 Apr 20" "GNU Bash-4.0"
.SH NAME
-bash, :, ., [, alias, bg, bind, break, builtin, cd, command, compgen, complete,
-continue, declare, dirs, disown, echo, enable, eval, exec, exit,
-export, fc, fg, getopts, hash, help, history, jobs, kill,
-let, local, logout, popd, printf, pushd, pwd, read, readonly, return, set,
-shift, shopt, source, suspend, test, times, trap, type, typeset,
+bash, :, ., [, alias, bg, bind, break, builtin, caller,
+cd, command, compgen, complete,
+compopt, continue, declare, dirs, disown, echo, enable, eval, exec, exit,
+export, false, fc, fg, getopts, hash, help, history, jobs, kill,
+let, local, logout, mapfile, popd, printf, pushd, pwd, read,
+readonly, return, set,
+shift, shopt, source, suspend, test, times, trap, true, type, typeset,
ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
.SH BASH BUILTIN COMMANDS
.nr zZ 1
diff --git a/doc/fdl.texi b/doc/fdl.texi
index 47ead9f0..96ce74ea 100644
--- a/doc/fdl.texi
+++ b/doc/fdl.texi
@@ -1,13 +1,12 @@
-
-@node GNU Free Documentation License
-@appendixsec GNU Free Documentation License
-
-@cindex FDL, GNU Free Documentation License
+@c The GNU Free Documentation License.
@center Version 1.2, November 2002
+@c This file is intended to be included within another document,
+@c hence no sectioning command or @node.
+
@display
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -344,7 +343,7 @@ and independent documents or works, in or on a volume of a storage or
distribution medium, is called an ``aggregate'' if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
-When the Document is included an aggregate, this License does not
+When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
@@ -408,7 +407,7 @@ as a draft) by the Free Software Foundation.
@end enumerate
@page
-@appendixsubsec ADDENDUM: How to use this License for your documents
+@heading ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
@@ -420,14 +419,14 @@ license notices just after the title page:
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
- A copy of the license is included in the section entitled ``GNU
+ with no 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 group
@end smallexample
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
-replace the ``with...Texts.'' line with this:
+replace the ``with@dots{}Texts.'' line with this:
@smallexample
@group
diff --git a/doc/rbash.1 b/doc/rbash.1
index c148abfa..56e38fd0 100644
--- a/doc/rbash.1
+++ b/doc/rbash.1
@@ -1,4 +1,4 @@
-.TH RBASH 1 "2004 Apr 20" "GNU Bash-3.0"
+.TH RBASH 1 "2004 Apr 20" "GNU Bash-4.0"
.SH NAME
rbash \- restricted bash, see \fBbash\fR(1)
.SH RESTRICTED SHELL
diff --git a/doc/version.texi b/doc/version.texi
index ca1a17ba..9993262d 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -1,10 +1,10 @@
@ignore
-Copyright (C) 1988-2006 Free Software Foundation, Inc.
+Copyright (C) 1988-2009 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Thu Sep 28 10:25:45 EDT 2006
+@set LASTCHANGE Mon Dec 29 16:48:40 EST 2008
-@set EDITION 3.2
-@set VERSION 3.2
-@set UPDATED 28 September 2006
-@set UPDATED-MONTH September 2006
+@set EDITION 4.0
+@set VERSION 4.0
+@set UPDATED 29 December 2008
+@set UPDATED-MONTH December 2008