Imported from ../bash-3.1.tar.gz.

This commit is contained in:
Jari Aalto 2005-12-07 14:08:12 +00:00
commit 95732b497d
267 changed files with 24541 additions and 18843 deletions

View file

@ -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-2004 Free Software Foundation, Inc.
Copyright @copyright{} 1988-2005 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@ -94,46 +94,28 @@ reference on shell behavior.
@menu
* Introduction:: An introduction to the shell.
* Definitions:: Some definitions used in the rest of this
manual.
* Basic Shell Features:: The shell "building blocks".
* Shell Builtin Commands:: Commands that are a part of the shell.
* Shell Variables:: Variables used or set by Bash.
* Bash Features:: Features found only in Bash.
* Job Control:: A chapter describing what job control is
and how Bash allows you to use it.
* Using History Interactively:: Chapter dealing with history expansion
rules.
* 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.
* 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.
@end menu
@ -143,7 +125,6 @@ reference on shell behavior.
@chapter Introduction
@menu
* What is Bash?:: A short description of Bash.
* What is a shell?:: A brief introduction to shells.
@end menu
@ -371,9 +352,7 @@ and to named files, and how the shell executes commands.
@section Shell Syntax
@menu
* Shell Operation:: The basic operation of the shell.
* Quoting:: How to remove the special meaning from characters.
* Comments:: How to specify comments.
@end menu
@ -444,7 +423,6 @@ status (@pxref{Exit Status}).
* Double Quotes:: How to suppress most of the interpretation of a
sequence of characters.
* ANSI-C Quoting:: How to expand ANSI-C sequences in quoted strings.
* Locale Translation:: How to translate strings into different languages.
@end menu
@ -457,7 +435,8 @@ parameter expansion.
Each of the shell metacharacters (@pxref{Definitions})
has special meaning to the shell and must be quoted if it is to
represent itself.
When the command history expansion facilities are being used, the
When the command history expansion facilities are being used
(@pxref{History Interaction}), the
@var{history expansion} character, usually @samp{!}, must be quoted
to prevent history expansion. @xref{Bash History Facilities}, for
more details concerning history expansion.
@ -486,7 +465,8 @@ between single quotes, even when preceded by a backslash.
Enclosing characters in double quotes (@samp{"}) preserves the literal value
of all characters within the quotes, with the exception of
@samp{$}, @samp{`}, and @samp{\}.
@samp{$}, @samp{`}, @samp{\},
and, when history expansion is enabled, @samp{!}.
The characters @samp{$} and @samp{`}
retain their special meaning within double quotes (@pxref{Shell Expansions}).
The backslash retains its special meaning only when followed by one of
@ -497,8 +477,9 @@ characters are removed. Backslashes preceding characters without a
special meaning are left unmodified.
A double quote may be quoted within double quotes by preceding it with
a backslash.
When command history is being used, the double quote may not be used to
quote the history expansion character.
If enabled, history expansion will be performed unless an @samp{!}
appearing in double quotes is escaped using a backslash.
The backslash preceding the @samp{!} is not removed.
The special parameters @samp{*} and @samp{@@} have special meaning
when in double quotes (@pxref{Shell Parameter Expansion}).
@ -864,6 +845,10 @@ 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})
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
@ -972,6 +957,10 @@ as primaries.
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})
is enabled, the match is performed without regard to the case
of alphabetic characters.
The return value is 0 if the string matches or does not match
the pattern, respectively, and 1 otherwise.
Any part of the pattern may be quoted to force it to be matched as a
@ -985,7 +974,7 @@ The return value is 0 if 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 @code{nocaseglob}
If the shell option @code{nocasematch}
(see the description of @code{shopt} in @ref{Bash Builtins})
is enabled, the match is performed without regard to the case
of alphabetic characters.
@ -1118,12 +1107,12 @@ The first element of the @env{FUNCNAME} variable is set to the
name of the function while the function is executing.
All other aspects of the shell execution
environment are identical between a function and its caller
with the exception that the @env{DEBUG} trap
below) is not inherited unless the function has been given the
with the exception that the @env{DEBUG} and @env{RETURN} traps
are not inherited unless the function has been given the
@code{trace} attribute using the @code{declare} builtin or
the @code{-o functrace} option has been enabled with
the @code{set} builtin,
(in which case all functions inherit the @code{DEBUG} trap).
(in which case all functions inherit the @env{DEBUG} and @env{RETURN} traps).
@xref{Bourne Shell Builtins}, for the description of the
@code{trap} builtin.
@ -1208,6 +1197,21 @@ Assignment statements may also appear as arguments to the
@code{declare}, @code{typeset}, @code{export}, @code{readonly},
and @code{local} builtin commands.
In the context where an assignment statement is assigning a value
to a shell variable or array index (@pxref{Arrays}), the @samp{+=}
operator can be used to
append to or add to the variable's previous value.
When @samp{+=} is applied to a variable for which the integer attribute
has been set, @var{value} is evaluated as an arithmetic expression and
added to the variable's current value, which is also evaluated.
When @samp{+=} is applied to an array variable using compound assignment
(@pxref{Arrays}), the
variable's value is not unset (as it is when using @samp{=}), and new
values are appended to the array beginning at one greater than the array's
maximum index.
When applied to a string-valued variable, @var{value} is expanded and
appended to the variable's value.
@node Positional Parameters
@subsection Positional Parameters
@cindex parameters, positional
@ -1256,6 +1260,10 @@ Expands to the positional parameters, starting from one. When the
expansion occurs within double quotes, each parameter expands to a
separate word. That is, @code{"$@@"} is equivalent to
@code{"$1" "$2" @dots{}}.
If the double-quoted expansion occurs within a word, the expansion of
the first parameter is joined with the beginning part of the original
word, and the expansion of the last parameter is joined with the last
part of the original word.
When there are no positional parameters, @code{"$@@"} and
@code{$@@}
expand to nothing (i.e., they are removed).
@ -1292,12 +1300,13 @@ to the filename used to invoke Bash, as given by argument zero.
@item _
(An underscore.)
At shell startup, set to the absolute filename of the shell or shell
script being executed as passed in the argument list.
At shell startup, set to the absolute pathname used to invoke the
shell or shell script being executed as passed in the environment
or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
Also set to the full pathname of each command executed and placed in
the environment exported to that command.
Also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file.
@end vtable
@ -1452,7 +1461,7 @@ If the login name is invalid, or the tilde expansion fails, the word is
left unchanged.
Each variable assignment is checked for unquoted tilde-prefixes immediately
following a @samp{:} or @samp{=}.
following a @samp{:} or the first @samp{=}.
In these cases, tilde expansion is also performed.
Consequently, one may use file names with tildes in assignments to
@env{PATH}, @env{MAILPATH}, and @env{CDPATH},
@ -1580,6 +1589,10 @@ parameters beginning at @var{offset}.
If @var{parameter} is an array name indexed by @samp{@@} or @samp{*},
the result is the @var{length}
members of the array beginning with @code{$@{@var{parameter}[@var{offset}]@}}.
A negative @var{offset} is taken relative to one greater than the maximum
index of the specified array.
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the @samp{:-} expansion.
Substring indexing is zero-based unless the positional parameters
are used, in which case the indexing starts at 1.
@ -1927,7 +1940,7 @@ Matches zero or more occurrences of the given patterns.
Matches one or more occurrences of the given patterns.
@item @@(@var{pattern-list})
Matches exactly one of the given patterns.
Matches one of the given patterns.
@item !(@var{pattern-list})
Matches anything except one of the given patterns.
@ -2013,6 +2026,10 @@ connection to the corresponding socket.
A failure to open or create a file causes the redirection to fail.
Redirections using file descriptors greater than 9 should be used with
care, as they may conflict with file descriptors the shell uses
internally.
@subsection Redirecting Input
Redirection of input causes the file whose name results from
the expansion of @var{word}
@ -2188,21 +2205,15 @@ is not specified. If the file does not exist, it is created.
@menu
* Simple Command Expansion:: How Bash expands simple commands before
executing them.
* Command Search and Execution:: How Bash finds commands and runs them.
* Command Execution Environment:: The environment in which Bash
executes commands that are not
shell builtins.
* Environment:: The environment given to a command.
* Exit Status:: The status returned by commands and how Bash
interprets it.
* Signals:: What happens when Bash or a command it runs
receives a signal.
@end menu
@node Simple Command Expansion
@ -2603,6 +2614,8 @@ Many of the builtins have been extended by @sc{posix} or Bash.
Unless otherwise noted, each builtin command documented as accepting
options preceded by @samp{-} accepts @samp{--}
to signify the end of the options.
For example, the @code{:}, @code{true}, @code{false}, and @code{test}
builtins do not accept options.
@node Bourne Shell Builtins
@section Bourne Shell Builtins
@ -2893,6 +2906,8 @@ Evaluate a conditional expression @var{expr}.
Each operator and operand must be a separate argument.
Expressions are composed of the primaries described below in
@ref{Bash Conditional Expressions}.
@code{test} does not accept any options, nor does it accept and ignore
an argument of @option{--} as signifying the end of options.
When the @code{[} form is used, the last argument to the command must
be a @code{]}.
@ -3256,7 +3271,8 @@ by subsequent assignment statements or unset.
@item -t
Give each @var{name} the @code{trace} attribute.
Traced functions inherit the @code{DEBUG} trap from the calling shell.
Traced functions inherit the @code{DEBUG} and @code{RETURN} traps from
the calling shell.
The trace attribute has no special meaning for variables.
@item -x
@ -3295,6 +3311,8 @@ even on systems where they are interpreted by default.
The @code{xpg_echo} shell option may be used to
dynamically determine whether or not @code{echo} expands these
escape characters by default.
@code{echo} does not interpret @option{--} to mean the end of options.
@code{echo} interprets the following escape sequences:
@table @code
@item \a
@ -3409,7 +3427,7 @@ parent.
@item printf
@btindex printf
@example
@code{printf} @var{format} [@var{arguments}]
@code{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}.
@ -3427,6 +3445,9 @@ beginning with @samp{\0} may contain up to four digits),
and @samp{%q} causes @code{printf} to output the
corresponding @var{argument} in a format that can be reused as shell input.
The @option{-v} option causes the output to be assigned to the variable
@var{var} rather than being printed to the standard output.
The @var{format} is reused as necessary to consume all of the @var{arguments}.
If the @var{format} requires more @var{arguments} than are supplied, the
extra format specifications behave as if a zero value or null string, as
@ -3610,6 +3631,20 @@ 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
@ -3692,6 +3727,11 @@ on an empty line.
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.
@ -3885,7 +3925,10 @@ set [--abefhkmnptuvxBCHP] [-o @var{option}] [@var{argument} @dots{}]
If no options or arguments are supplied, @code{set} displays the names
and values of all shell variables and functions, sorted according to the
current locale, in a format that may be reused as input.
current locale, in a format that may be reused as input
for setting or resetting the currently-set variables.
Read-only variables cannot be reset.
In @sc{posix} mode, only shell variables are listed.
When options are supplied, they set or unset shell attributes.
Options, if specified, have the following meanings:
@ -4096,9 +4139,11 @@ $ cd ..; pwd
@end example
@item -T
If set, any trap on @code{DEBUG} is inherited by shell functions, command
substitutions, and commands executed in a subshell environment.
The @code{DEBUG} trap is normally not inherited in such cases.
If set, any trap on @code{DEBUG} and @code{RETURN} are inherited by
shell functions, command substitutions, and commands executed
in a subshell environment.
The @code{DEBUG} and @code{RETURN} traps are normally not inherited
in such cases.
@item --
If no arguments follow this option, then the positional parameters are
@ -4249,6 +4294,10 @@ parameters to the current subroutine (shell function or script executed
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}
for a description of the @code{extdebug} option to the @code{shopt}
builtin).
@item BASH_ARGV
An array variable containing all of the parameters in the current bash
@ -4256,6 +4305,10 @@ execution call stack. The final parameter of the last subroutine call
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
are pushed onto @code{BASH_ARGV}.
The shell sets @code{BASH_ARGV} only when in extended debugging mode
(see @ref{Bash Builtins}
for a description of the @code{extdebug} option to the @code{shopt}
builtin).
@item BASH_COMMAND
The command currently being executed or about to be executed, unless the
@ -4274,8 +4327,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 + 1]@}} was called.
The corresponding source file name is @code{$@{BASH_SOURCE[$i + 1]@}}.
@code{$@{FUNCNAME[$i]@}} was called.
The corresponding source file name is @code{$@{BASH_SOURCE[$i]@}}.
Use @code{LINENO} to obtain the current line number.
@item BASH_REMATCH
@ -4731,6 +4784,10 @@ prompt when the shell is interactive.
Bash terminates after that number of seconds if input does
not arrive.
@item TMPDIR
If set, Bash uses its value as the name of a directory in which
Bash creates temporary files for the shell's use.
@item UID
The numeric real user id of the current user. This variable is readonly.
@ -4783,7 +4840,7 @@ option).
@item --dump-po-strings
A list of all double-quoted strings preceded by @samp{$}
is printed on the standard ouput
is printed on the standard output
in the @sc{gnu} @code{gettext} PO (portable object) file format.
Equivalent to @option{-D} except for the output format.
@ -4870,7 +4927,7 @@ when invoking an interactive shell.
@item -D
A list of all double-quoted strings preceded by @samp{$}
is printed on the standard ouput.
is printed on the standard output.
These are the strings that
are subject to language translation when the current locale
is not @code{C} or @code{POSIX} (@pxref{Locale Translation}).
@ -5166,6 +5223,7 @@ shell to exit.
@item
When running in @sc{posix} mode, a special builtin returning an error
status will not cause the shell to exit (@pxref{Bash POSIX Mode}).
@item
A failed @code{exec} will not cause the shell to exit
(@pxref{Bourne Shell Builtins}).
@ -5201,6 +5259,9 @@ If the @var{file} argument to one of the primaries is one of
@file{/dev/stdin}, @file{/dev/stdout}, or @file{/dev/stderr}, file
descriptor 0, 1, or 2, respectively, is checked.
Unless otherwise specified, primaries that operate on files follow symbolic
links and operate on the target of the link, rather than the link itself.
@table @code
@item -a @var{file}
True if @var{file} exists.
@ -5414,7 +5475,7 @@ omitted, then base 10 is used.
The digits greater than 9 are represented by the lowercase letters,
the uppercase letters, @samp{@@}, and @samp{_}, in that order.
If @var{base} is less than or equal to 36, lowercase and uppercase
letters may be used interchangably to represent numbers between 10
letters may be used interchangeably to represent numbers between 10
and 35.
Operators are evaluated in order of precedence. Sub-expressions in
@ -5534,12 +5595,18 @@ The braces are required to avoid
conflicts with the shell's filename expansion operators. If the
@var{subscript} is @samp{@@} or @samp{*}, the word expands to all members
of the array @var{name}. These subscripts differ only when the word
appears within double quotes. If the word is double-quoted,
appears within double quotes.
If the word is double-quoted,
@code{$@{name[*]@}} expands to a single word with
the value of each array member separated by the first character of the
@env{IFS} variable, and @code{$@{name[@@]@}} expands each element of
@var{name} to a separate word. When there are no array members,
@code{$@{name[@@]@}} expands to nothing. This is analogous to the
@code{$@{name[@@]@}} expands to nothing.
If the double-quoted expansion occurs within a word, the expansion of
the first parameter is joined with the beginning part of the original
word, and the expansion of the last parameter is joined with the last
part of the original word.
This is analogous to the
expansion of the special parameters @samp{@@} and @samp{*}.
@code{$@{#name[}@var{subscript}@code{]@}} expands to the length of
@code{$@{name[}@var{subscript}@code{]@}}.
@ -5551,6 +5618,8 @@ referencing element zero.
The @code{unset} builtin is used to destroy arrays.
@code{unset} @var{name}[@var{subscript}]
destroys the array element at index @var{subscript}.
Care must be taken to avoid unwanted side effects caused by filename
generation.
@code{unset} @var{name}, where @var{name} is an array, removes the
entire array. A subscript of @samp{*} or @samp{@@} also removes the
entire array.
@ -5843,7 +5912,13 @@ is stopped is `Stopped(@var{signame})', where @var{signame} is, for
example, @code{SIGTSTP}.
@item
Reserved words may not be aliased.
The @code{bg} builtin uses the required format to describe each job placed
in the background, which does not include an indication of whether the job
is the current or previous job.
@item
Reserved words appearing in a context where reserved words are recognized
do not undergo alias expansion.
@item
The @sc{posix} 1003.2 @env{PS1} and @env{PS2} expansions of @samp{!} to
@ -5894,7 +5969,7 @@ may not start with a digit. Declaring a function with an invalid name
causes a fatal syntax error in non-interactive shells.
@item
@sc{posix} 1003.2 `special' builtins are found before shell functions
@sc{posix} 1003.2 special builtins are found before shell functions
during command lookup.
@item
@ -5904,12 +5979,6 @@ the POSIX.2 standard, and include things like passing incorrect options,
redirection errors, variable assignment errors for assignments preceding
the command name, and so on.
@item
If the @code{cd} builtin finds a directory to change to
using @env{$CDPATH}, the
value it assigns to the @env{PWD} variable does not contain any
symbolic links, as if @samp{cd -P} had been executed.
@item
If @env{CDPATH} is set, the @code{cd} builtin will not implicitly
append the current directory to it. This means that @code{cd} will
@ -5989,29 +6058,61 @@ When the @code{cd} builtin is invoked in @var{logical} mode, and the pathname
constructed from @code{$PWD} and the directory name supplied as an argument
does not refer to an existing directory, @code{cd} will fail instead of
falling back to @var{physical} mode.
@item
When the @code{pwd} builtin is supplied the @option{-P} option, it resets
@code{$PWD} to a pathname containing no symlinks.
@item
The @code{pwd} builtin verifies that the value it prints is the same as the
current directory, even if it is not asked to check the file system with the
@option{-P} option.
@item
When listing the history, the @code{fc} builtin does not include an
indication of whether or not a history entry has been modified.
@item
The default editor used by @code{fc} is @code{ed}.
@item
The @code{type} and @code{command} builtins will not report a non-executable
file as having been found, though the shell will attempt to execute such a
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
@code{$EDITOR}.
@item
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.
@end enumerate
There is other @sc{posix} 1003.2 behavior that Bash does not implement.
There is other @sc{posix} 1003.2 behavior that Bash does not implement by
default even when in @sc{posix} mode.
Specifically:
@enumerate
@item
Assignment statements affect the execution environment of all
builtins, not just special ones.
@item
When a subshell is created to execute a shell script with execute permission,
but without a leading @samp{#!}, Bash sets @code{$0} to the full pathname of
the script as found by searching @code{$PATH}, rather than the command as
typed by the user.
The @code{fc} builtin checks @code{$EDITOR} as a program to edit history
entries if @code{FCEDIT} is unset, rather than defaulting directly to
@code{ed}. @code{fc} uses @code{ed} if @code{EDITOR} is unset.
@item
When using @samp{.} to source a shell script found in @code{$PATH}, bash
checks execute permission bits rather than read permission bits, just as
if it were searching for a command.
As noted above, Bash requires the @code{xpg_echo} option to be enabled for
the @code{echo} builtin to be fully conformant.
@end enumerate
Bash can be configured to be @sc{posix}-conformant by default, by specifying
the @option{--enable-strict-posix-default} to @code{configure} when building
(@pxref{Optional Features}).
@node Job Control
@chapter Job Control
@ -6087,11 +6188,12 @@ There are a number of ways to refer to a job in the shell. The
character @samp{%} introduces a job name.
Job number @code{n} may be referred to as @samp{%n}.
The symbols @samp{%%} and
@samp{%+} 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. The
previous job may be referenced using @samp{%-}. In output
The symbols @samp{%%} and @samp{%+} 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 @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
previous job with a @samp{-}.
@ -6132,15 +6234,15 @@ Bash does not print another warning, and the stopped jobs are terminated.
@item bg
@btindex bg
@example
bg [@var{jobspec}]
bg [@var{jobspec} @dots{}]
@end example
Resume the suspended job @var{jobspec} in the background, as if it
Resume each suspended job @var{jobspec} in the background, as if it
had been started with @samp{&}.
If @var{jobspec} is not supplied, the current job is used.
The return status is zero unless it is run when job control is not
enabled, or, when run with job control enabled, if @var{jobspec} was
not found or @var{jobspec} specifies a job that was started without
job control.
enabled, or, when run with job control enabled, any
@var{jobspec} was not found or specifies a job
that was started without job control.
@item fg
@btindex fg
@ -6216,11 +6318,11 @@ or non-zero if an error occurs or an invalid option is encountered.
@item wait
@btindex wait
@example
wait [@var{jobspec} or @var{pid}]
wait [@var{jobspec} or @var{pid} ...]
@end example
Wait until the child process specified by process @sc{id} @var{pid} or job
specification @var{jobspec} exits and return the exit status of the last
command waited for.
Wait until the child process specified by each process @sc{id} @var{pid}
or job specification @var{jobspec} exits and return the exit status of the
last command waited for.
If a job spec is given, all processes in the job are waited for.
If no arguments are given, all currently active child processes are
waited for, and the return status is zero.
@ -6304,23 +6406,16 @@ Other independent ports exist for
@menu
* Basic Installation:: Installation instructions.
* Compilers and Options:: How to set special options for various
systems.
* Compiling For Multiple Architectures:: How to compile Bash for more
than one kind of system from
the same source tree.
* Installation Names:: How to set the various paths used by the installation.
* Specifying the System Type:: How to configure Bash for a particular system.
* Sharing Defaults:: How to share default configuration values among GNU
programs.
* Operation Controls:: Options recognized by the configuration program.
* Optional Features:: How to enable and disable optional features when
building Bash.
@end menu
@ -6561,10 +6656,10 @@ Define if you are using the Andrew File System from Transarc.
@item --with-bash-malloc
Use the Bash version of
@code{malloc} in @file{lib/malloc/malloc.c}. This is not the same
@code{malloc} in the directory @file{lib/malloc}. This is not the same
@code{malloc} that appears in @sc{gnu} libc, but an older version
derived from the 4.2 @sc{bsd} @code{malloc}. This @code{malloc} is
very fast, but wastes some space on each allocation.
originally derived from the 4.2 @sc{bsd} @code{malloc}. This @code{malloc}
is very fast, but wastes some space on each allocation.
This option is enabled by default.
The @file{NOTES} file contains a list of systems for
which this should be turned off, and @code{configure} disables this
@ -6581,7 +6676,7 @@ A synonym for @code{--with-bash-malloc}.
@item --with-installed-readline[=@var{PREFIX}]
Define this to make Bash link with a locally-installed version of Readline
rather than the version in @file{lib/readline}. This works only with
Readline 4.3 and later versions. If @var{PREFIX} is @code{yes} or not
Readline 5.0 and later versions. If @var{PREFIX} is @code{yes} or not
supplied, @code{configure} uses the values of the make variables
@code{includedir} and @code{libdir}, which are subdirectories of @code{prefix}
by default, to find the installed version of Readline if it is not in
@ -6669,6 +6764,9 @@ Include support for matching POSIX regular expressions using the
@samp{=~} binary operator in the @code{[[} conditional command.
(@pxref{Conditional Constructs}).
@item --enable-debugger
Include support for the bash debugger (distributed separately).
@item --enable-directory-stack
Include support for a @code{csh}-like directory stack and the
@code{pushd}, @code{popd}, and @code{dirs} builtins
@ -6714,17 +6812,17 @@ when used in redirections (@pxref{Redirections}).
This enables process substitution (@pxref{Process Substitution}) if
the operating system provides the necessary support.
@item --enable-progcomp
Enable the programmable completion facilities
(@pxref{Programmable Completion}).
If Readline is not enabled, this option has no effect.
@item --enable-prompt-string-decoding
Turn on the interpretation of a number of backslash-escaped characters
in the @env{$PS1}, @env{$PS2}, @env{$PS3}, and @env{$PS4} prompt
strings. See @ref{Printing a Prompt}, for a complete list of prompt
string escape sequences.
@item --enable-progcomp
Enable the programmable completion facilities
(@pxref{Programmable Completion}).
If Readline is not enabled, this option has no effect.
@item --enable-readline
Include support for command-line editing and history with the Bash
version of the Readline library (@pxref{Command Line Editing}).
@ -6738,6 +6836,19 @@ when called as @code{rbash}, enters a restricted mode. See
Include the @code{select} builtin, which allows the generation of simple
menus (@pxref{Conditional Constructs}).
@item --enable-separate-helpfiles
Use external files for the documentation displayed by the @code{help} builtin
instead of storing the text internally.
@item --enable-single-help-strings
Store the text displayed by the @code{help} builtin as a single string for
each help topic. This aids in translating the text to different languages.
You may need to disable this if your compiler cannot handle very long string
literals.
@item --enable-strict-posix-default
Make Bash @sc{posix}-conformant by default (@pxref{Bash POSIX Mode}).
@item --enable-usg-echo-default
A synonym for @code{--enable-xpg-echo-default}.
@ -6746,7 +6857,7 @@ Make the @code{echo} builtin expand backslash-escaped characters by default,
without requiring the @option{-e} option.
This sets the default value of the @code{xpg_echo} shell option to @code{on},
which makes the Bash @code{echo} behave more like the version specified in
the Single Unix Specification, version 2.
the Single Unix Specification, version 3.
@xref{Bash Builtins}, for a description of the escape sequences that
@code{echo} recognizes.
@ -6810,8 +6921,8 @@ differences between the traditional Bourne shell and Bash; this
section quickly details the differences of significance. A
number of these differences are explained in greater depth in
previous sections.
This section uses the version of @code{sh} included in SVR4.2 as
the baseline reference.
This section uses the version of @code{sh} included in SVR4.2 (the
last version of the historical Bourne shell) as the baseline reference.
@itemize @bullet
@ -6863,6 +6974,8 @@ invocation options list the translatable strings found in a script
Bash implements the @code{!} keyword to negate the return value of
a pipeline (@pxref{Pipelines}).
Very useful when an @code{if} statement needs to act only if a test fails.
The Bash @samp{-o pipefail} option to @code{set} will cause a pipeline to
return a failure status if any command fails.
@item
Bash has the @code{time} reserved word and command timing (@pxref{Pipelines}).
@ -6879,7 +6992,12 @@ generation of simple menus (@pxref{Conditional Constructs}).
@item
Bash includes the @code{[[} compound command, which makes conditional
testing part of the shell grammar (@pxref{Conditional Constructs}).
testing part of the shell grammar (@pxref{Conditional Constructs}), including
optional regular expression matching.
@item
Bash provides optional case-insensitive matching for the @code{case} and
@code{[[} constructs.
@item
Bash includes brace expansion (@pxref{Brace Expansion}) and tilde
@ -6900,6 +7018,10 @@ exported to child processes. The Bourne shell does not normally do
this unless the variables are explicitly marked using the @code{export}
command.
@item
Bash supports the @samp{+=} assignment operator, which appends to the value
of the variable named on the left hand side.
@item
Bash includes the @sc{posix} pattern removal @samp{%}, @samp{#}, @samp{%%}
and @samp{##} expansions to remove leading or trailing substrings from
@ -6991,6 +7113,14 @@ opened for both reading and writing, and the @samp{&>} redirection
operator, for directing standard output and standard error to the same
file (@pxref{Redirections}).
@item
Bash includes the @samp{<<<} redirection operator, allowing a string to
be used as the standard input to a command.
@item
Bash implements the @samp{[n]<&@var{word}} and @samp{[n]>&@var{word}}
redirection operators, which move one file descriptor to another.
@item
Bash treats a number of filenames specially when they are
used in redirection operators (@pxref{Redirections}).
@ -7126,7 +7256,9 @@ The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows a
Commands specified with an @code{RETURN} trap are executed before
execution resumes after a shell function or a shell script executed with
@code{.} or @code{source} returns.
The @code{RETURN} trap is not inherited by shell functions.
The @code{RETURN} trap is not inherited by shell functions unless the
function has been given the @code{trace} attribute or the
@code{functrace} option has been enabled using the @code{shopt} builtin.
@item
The Bash @code{type} builtin is more extensive and gives more information
@ -7158,6 +7290,10 @@ job table (@pxref{Job Control Builtins}) or suppress the sending
of @code{SIGHUP} to a job when the shell exits as the result of a
@code{SIGHUP}.
@item
Bash includes a number of features to support a separate debugger for
shell scripts.
@item
The SVR4.2 shell has two privilege-related builtins
(@code{mldmode} and @code{priv}) not present in Bash.