@quotation
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.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) below. A copy of the license is
@top Bash Features
This text is a brief description of the features that are present in
-the Bash shell (version @value{VERSION}, @value{UPDATED})..
+the Bash shell (version @value{VERSION}, @value{UPDATED}).
This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The GNU Bash Reference Manual},
Bash is largely compatible with @code{sh} and incorporates useful
features from the Korn shell @code{ksh} and the C shell @code{csh}.
It is intended to be a conformant implementation of the @sc{ieee}
-@sc{posix} Shell and Tools specification (@sc{ieee} Working Group 1003.2).
+@sc{posix} Shell and Tools portion of the @sc{ieee} @sc{posix}
+specification (@sc{ieee} Standard 1003.1).
It offers functional improvements over @code{sh} for both interactive and
programming use.
@item POSIX
@cindex POSIX
A family of open system standards based on Unix. Bash
-is concerned with @sc{posix} 1003.2, the Shell and Tools Standard.
+is primarily concerned with the Shell and Utilities portion of the
+@sc{posix} 1003.1 standard.
@item blank
A space or tab character.
@item special builtin
@cindex special builtin
A shell builtin command that has been classified as special by the
-@sc{posix} 1003.2 standard.
+@sc{posix} standard.
@item token
@cindex token
(see the description of @code{shopt} in @ref{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, respectively, and 1 otherwise.
+The return value is 0 if the string matches (@samp{==}) or does not
+match (@samp{!=})the pattern, and 1 otherwise.
Any part of the pattern may be quoted to force it to be matched as a
string.
Any redirections (@pxref{Redirections}) associated with the shell function
are performed when the function is executed.
+A function definition may be deleted using the @option{-f} option to the
+@code{unset} builtin (@pxref{Bourne Shell Builtins}).
+
The exit status of a function definition is zero unless a syntax error
occurs or a readonly function with the same name already exists.
When executed, the exit status of a function is the exit status of the
array in turn, and the expansion is the resultant list.
@item $@{@var{parameter}/@var{pattern}/@var{string}@}
-@itemx $@{@var{parameter}//@var{pattern}/@var{string}@}
The @var{pattern} is expanded to produce a pattern just as in
filename expansion.
@var{Parameter} is expanded and the longest match of @var{pattern}
against its value is replaced with @var{string}.
-In the first form, only the first match is replaced.
-The second form causes all matches of @var{pattern} to be
-replaced with @var{string}.
+If @var{pattern} begins with @samp{/}, all matches of @var{pattern} are
+replaced with @var{string}. Normally only the first match is replaced.
If @var{pattern} begins with @samp{#}, it must match at the beginning
of the expanded value of @var{parameter}.
If @var{pattern} begins with @samp{%}, it must match at the end
Within @samp{[} and @samp{]}, @var{character classes} can be specified
using the syntax
@code{[:}@var{class}@code{:]}, where @var{class} is one of the
-following classes defined in the @sc{posix} 1003.2 standard:
+following classes defined in the @sc{posix} standard:
@example
alnum alpha ascii blank cntrl digit graph lower
print punct space upper word xdigit
* The Set Builtin:: This builtin is so overloaded it
deserves its own section.
* Special Builtins:: Builtin commands classified specially by
- POSIX.2.
+ POSIX.
@end menu
Builtin commands are contained within the shell itself.
Builtin commands are necessary to implement functionality impossible
or inconvenient to obtain with separate utilities.
-This section briefly the builtins which Bash inherits from
+This section briefly describes the builtins which Bash inherits from
the Bourne Shell, as well as the builtin commands which are unique
to or have been extended in Bash.
@section Bourne Shell Builtins
The following shell builtin commands are inherited from the Bourne Shell.
-These commands are implemented as specified by the @sc{posix} 1003.2 standard.
+These commands are implemented as specified by the @sc{posix} standard.
@table @code
@item : @r{(a colon)}
@item hash
@btindex hash
@example
-hash [-'r] [-p @var{filename}] [-dt] [@var{name}]
+hash [-r] [-p @var{filename}] [-dt] [@var{name}]
@end example
Remember the full pathnames of commands specified as @var{name} arguments,
so they need not be searched for on subsequent invocations.
@code{source} builtins finishes executing.
Signals ignored upon entry to the shell cannot be trapped or reset.
-Trapped signals are reset to their original values in a child
-process when it is created.
+Trapped signals that are not being ignored are reset to their original
+values in a child process when it is created.
The return status is zero unless a @var{sigspec} does not specify a
valid signal.
This section describes builtin commands which are unique to
or have been extended in Bash.
-Some of these commands are specified in the @sc{posix} 1003.2 standard.
+Some of these commands are specified in the @sc{posix} standard.
@table @code
@item \0@var{nnn}
the eight-bit character whose value is the octal value @var{nnn}
(zero to three octal digits)
-@item \@var{nnn}
-the eight-bit character whose value is the octal value @var{nnn}
-(one to three octal digits)
@item \x@var{HH}
the eight-bit character whose value is the hexadecimal value @var{HH}
(one or two hex digits)
@item ulimit
@btindex ulimit
@example
-ulimit [-acdflmnpstuvSH] [@var{limit}]
+ulimit [-acdefilmnpqrstuvxSH] [@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
@item -d
The maximum size of a process's data segment.
+@item -e
+The maximum scheduling priority ("nice").
+
@item -f
-The maximum size of files created by the shell.
+The maximum size of files written by the shell and its children.
+
+@item -i
+The maximum number of pending signals.
@item -l
The maximum size that may be locked into memory.
@item -p
The pipe buffer size.
+@item -q
+The maximum number of bytes in POSIX message queues.
+
+@item -r
+The maximum real-time scheduling priority.
+
@item -s
The maximum stack size.
@item -v
The maximum amount of virtual memory available to the process.
+@item -x
+The maximum number of file locks.
+
@end table
If @var{limit} is given, it is the new value of the specified resource;
@item posix
Change the behavior of Bash where the default operation differs
-from the @sc{posix} 1003.2 standard to match the standard
+from the @sc{posix} standard to match the standard
(@pxref{Bash POSIX Mode}).
This is intended to make Bash behave as a strict superset of that
standard.
Print shell input lines as they are read.
@item -x
-Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP
-commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands
+Print a trace of simple commands, @code{for} commands, @code{case}
+commands, @code{select} commands, and arithmetic @code{for} commands
and their arguments or associated word lists after they are
expanded and before they are executed. The value of the @env{PS4}
variable is expanded and the resultant value is printed before
@section Special Builtins
@cindex special builtin
-For historical reasons, the @sc{posix} 1003.2 standard has classified
+For historical reasons, the @sc{posix} standard has classified
several builtin commands as @emph{special}.
When Bash is executing in @sc{posix} mode, the special builtins
differ from other builtin commands in three respects:
@item COMP_WORDS
An array variable consisting of the individual
words in the current command line.
+The words are split on shell metacharacters as the shell parser would
+separate them.
This variable is available only in shell functions invoked by the
programmable completion facilities (@pxref{Programmable Completion}).
@item HISTFILESIZE
The maximum number of lines contained in the history file. When this
variable is assigned a value, the history file is truncated, if
-necessary, to contain no more than that number of lines.
+necessary, by removing the oldest entries,
+to contain no more than that number of lines.
The history file is also truncated to this size after
writing it when an interactive shell exits.
The default value is 500.
@item --posix
Change the behavior of Bash where the default operation differs
-from the @sc{posix} 1003.2 standard to match the standard. This
+from the @sc{posix} standard to match the standard. This
is intended to make Bash behave as a strict superset of that
standard. @xref{Bash POSIX Mode}, for a description of the Bash
@sc{posix} mode.
Starting Bash with the @option{--posix} command-line option or executing
@samp{set -o posix} while Bash is running will cause Bash to conform more
-closely to the @sc{posix} 1003.2 standard by changing the behavior to
+closely to the @sc{posix} standard by changing the behavior to
match that specified by @sc{posix} in areas where the Bash default differs.
When invoked as @code{sh}, Bash enters @sc{posix} mode after reading the
do not undergo alias expansion.
@item
-The @sc{posix} 1003.2 @env{PS1} and @env{PS2} expansions of @samp{!} to
+The @sc{posix} @env{PS1} and @env{PS2} expansions of @samp{!} to
the history number and @samp{!!} to @samp{!} are enabled,
and parameter expansion is performed on the values of @env{PS1} and
@env{PS2} regardless of the setting of the @code{promptvars} option.
@item
-The @sc{posix} 1003.2 startup files are executed (@env{$ENV}) rather than
+The @sc{posix} startup files are executed (@env{$ENV}) rather than
the normal Bash files.
@item
causes a fatal syntax error in non-interactive shells.
@item
-@sc{posix} 1003.2 special builtins are found before shell functions
+@sc{posix} special builtins are found before shell functions
during command lookup.
@item
-If a @sc{posix} 1003.2 special builtin returns an error status, a
+If a @sc{posix} special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
-the POSIX.2 standard, and include things like passing incorrect options,
+the POSIX standard, and include things like passing incorrect options,
redirection errors, variable assignment errors for assignments preceding
the command name, and so on.
Process substitution is not available.
@item
-Assignment statements preceding @sc{posix} 1003.2 special builtins
+Assignment statements preceding @sc{posix} special builtins
persist in the shell environment after the builtin completes.
@item
@item
The @code{export} and @code{readonly} builtin commands display their
-output in the format required by @sc{posix} 1003.2.
+output in the format required by @sc{posix}.
@item
The @code{trap} builtin displays signal names without the leading
@end enumerate
-There is other @sc{posix} 1003.2 behavior that Bash does not implement by
+There is other @sc{posix} behavior that Bash does not implement by
default even when in @sc{posix} mode.
Specifically:
Bash implements essentially the same grammar, parameter and
variable expansion, redirection, and quoting as the Bourne Shell.
-Bash uses the @sc{posix} 1003.2 standard as the specification of
+Bash uses the @sc{posix} standard as the specification of
how these features are to be implemented. There are some
differences between the traditional Bourne shell and Bash; this
section quickly details the differences of significance. A
This closes a longstanding shell security hole.
@item
-Bash implements the full set of @sc{posix} 1003.2 filename expansion operators,
+Bash implements the full set of @sc{posix} filename expansion operators,
including @var{character classes}, @var{equivalence classes}, and
@var{collating symbols} (@pxref{Filename Expansion}).
@item
The SVR4.2 shell exits a script if any builtin fails; Bash exits
-a script only if one of the @sc{posix} 1003.2 special builtins fails, and
-only for certain failures, as enumerated in the @sc{posix} 1003.2 standard.
+a script only if one of the @sc{posix} special builtins fails, and
+only for certain failures, as enumerated in the @sc{posix} standard.
@item
The SVR4.2 shell behaves differently when invoked as @code{jsh}