commit bash-20090205 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:36:56 -05:00
parent c1d39fb8cf
commit db31fb2644
41 changed files with 8069 additions and 5416 deletions
+96 -88
View File
@@ -9,7 +9,7 @@ SSYYNNOOPPSSIISS
bbaasshh [options] [file]
CCOOPPYYRRIIGGHHTT
Bash is Copyright (C) 1989-2008 by the Free Software Foundation, Inc.
Bash is Copyright (C) 1989-2009 by the Free Software Foundation, Inc.
DDEESSCCRRIIPPTTIIOONN
BBaasshh is an sshh-compatible command language interpreter that executes
@@ -475,7 +475,9 @@ SSHHEELLLL GGRRAAMMMMAARR
ccoopprroocc [_N_A_M_E] _c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n_s]
This creates a coprocess named _N_A_M_E. If _N_A_M_E is not supplied, the
default name is _C_O_P_R_O_C. When the coproc is executed, the shell creates
default name is _C_O_P_R_O_C. _N_A_M_E must not be supplied if _c_o_m_m_a_n_d is a _s_i_m_-
_p_l_e _c_o_m_m_a_n_d (see above); otherwise, it is interpreted as the first word
of the simple command. When the coproc is executed, the shell creates
an array variable (see AArrrraayyss below) named _N_A_M_E in the context of the
executing shell. The standard output of _c_o_m_m_a_n_d is connected via a
pipe to a file descriptor in the executing shell, and that file
@@ -1391,138 +1393,140 @@ EEXXPPAANNSSIIOONN
tion.
In each of the cases below, _w_o_r_d is subject to tilde expansion, parame-
ter expansion, command substitution, and arithmetic expansion. When
not performing substring expansion, bbaasshh tests for a parameter that is
unset or null; omitting the colon results in a test only for a parame-
ter that is unset.
ter expansion, command substitution, and arithmetic expansion.
When not performing substring expansion, using the forms documented
below, bbaasshh tests for a parameter that is unset or null. Omitting the
colon results in a test only for a parameter that is unset.
${_p_a_r_a_m_e_t_e_r::--_w_o_r_d}
UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the expan-
sion of _w_o_r_d is substituted. Otherwise, the value of _p_a_r_a_m_e_t_e_r
UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the expan-
sion of _w_o_r_d is substituted. Otherwise, the value of _p_a_r_a_m_e_t_e_r
is substituted.
${_p_a_r_a_m_e_t_e_r::==_w_o_r_d}
AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the
AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the
expansion of _w_o_r_d is assigned to _p_a_r_a_m_e_t_e_r. The value of _p_a_r_a_m_-
_e_t_e_r is then substituted. Positional parameters and special
_e_t_e_r is then substituted. Positional parameters and special
parameters may not be assigned to in this way.
${_p_a_r_a_m_e_t_e_r::??_w_o_r_d}
DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is null or unset,
the expansion of _w_o_r_d (or a message to that effect if _w_o_r_d is
not present) is written to the standard error and the shell, if
DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is null or unset,
the expansion of _w_o_r_d (or a message to that effect if _w_o_r_d is
not present) is written to the standard error and the shell, if
it is not interactive, exits. Otherwise, the value of _p_a_r_a_m_e_t_e_r
is substituted.
${_p_a_r_a_m_e_t_e_r::++_w_o_r_d}
UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is null or unset, nothing is
UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is null or unset, nothing is
substituted, otherwise the expansion of _w_o_r_d is substituted.
${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t}
${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t::_l_e_n_g_t_h}
SSuubbssttrriinngg EExxppaannssiioonn.. Expands to up to _l_e_n_g_t_h characters of
_p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_s_e_t. If
_l_e_n_g_t_h is omitted, expands to the substring of _p_a_r_a_m_e_t_e_r start-
SSuubbssttrriinngg EExxppaannssiioonn.. Expands to up to _l_e_n_g_t_h characters of
_p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_s_e_t. If
_l_e_n_g_t_h is omitted, expands to the substring of _p_a_r_a_m_e_t_e_r start-
ing at the character specified by _o_f_f_s_e_t. _l_e_n_g_t_h and _o_f_f_s_e_t are
arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below).
_l_e_n_g_t_h must evaluate to a number greater than or equal to zero.
If _o_f_f_s_e_t evaluates to a number less than zero, the value is
used as an offset from the end of the value of _p_a_r_a_m_e_t_e_r. If
_p_a_r_a_m_e_t_e_r is @@, the result is _l_e_n_g_t_h positional parameters
arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below).
_l_e_n_g_t_h must evaluate to a number greater than or equal to zero.
If _o_f_f_s_e_t evaluates to a number less than zero, the value is
used as an offset from the end of the value of _p_a_r_a_m_e_t_e_r. If
_p_a_r_a_m_e_t_e_r is @@, the result is _l_e_n_g_t_h positional parameters
beginning at _o_f_f_s_e_t. If _p_a_r_a_m_e_t_e_r is an indexed array name sub-
scripted by @ or *, the result is the _l_e_n_g_t_h members of the
scripted by @ or *, the result is the _l_e_n_g_t_h members of the
array beginning with ${_p_a_r_a_m_e_t_e_r[_o_f_f_s_e_t]}. A negative _o_f_f_s_e_t 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 by default. If _o_f_f_s_e_t is 0, and
the positional parameters are used, $$00 is prefixed to the list.
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 by default. If _o_f_f_s_e_t is 0, and
the positional parameters are used, $$00 is prefixed to the list.
${!!_p_r_e_f_i_x**}
${!!_p_r_e_f_i_x@@}
NNaammeess mmaattcchhiinngg pprreeffiixx.. Expands to the names of variables whose
NNaammeess mmaattcchhiinngg pprreeffiixx.. Expands to the names of variables whose
names begin with _p_r_e_f_i_x, separated by the first character of the
IIFFSS special variable. When _@ is used and the expansion appears
within double quotes, each variable name expands to a separate
IIFFSS special variable. When _@ is used and the expansion appears
within double quotes, each variable name expands to a separate
word.
${!!_n_a_m_e[_@]}
${!!_n_a_m_e[_*]}
LLiisstt ooff aarrrraayy kkeeyyss.. If _n_a_m_e is an array variable, expands to
the list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is
not an array, expands to 0 if _n_a_m_e is set and null otherwise.
When _@ is used and the expansion appears within double quotes,
LLiisstt ooff aarrrraayy kkeeyyss.. If _n_a_m_e is an array variable, expands to
the list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is
not an array, expands to 0 if _n_a_m_e is set and null otherwise.
When _@ is used and the expansion appears within double quotes,
each key expands to a separate word.
${##_p_a_r_a_m_e_t_e_r}
PPaarraammeetteerr lleennggtthh.. The length in characters of the value of
_p_a_r_a_m_e_t_e_r is substituted. If _p_a_r_a_m_e_t_e_r is ** or @@, the value
substituted is the number of positional parameters. If _p_a_r_a_m_e_-
_t_e_r is an array name subscripted by ** or @@, the value substi-
PPaarraammeetteerr lleennggtthh.. The length in characters of the value of
_p_a_r_a_m_e_t_e_r is substituted. If _p_a_r_a_m_e_t_e_r is ** or @@, the value
substituted is the number of positional parameters. If _p_a_r_a_m_e_-
_t_e_r is an array name subscripted by ** or @@, the value substi-
tuted is the number of elements in the array.
${_p_a_r_a_m_e_t_e_r##_w_o_r_d}
${_p_a_r_a_m_e_t_e_r####_w_o_r_d}
RReemmoovvee mmaattcchhiinngg pprreeffiixx ppaatttteerrnn.. The _w_o_r_d is expanded to produce
a pattern just as in pathname expansion. If the pattern matches
the beginning of the value of _p_a_r_a_m_e_t_e_r, then the result of the
expansion is the expanded value of _p_a_r_a_m_e_t_e_r with the shortest
matching pattern (the ``##'' case) or the longest matching pat-
tern (the ``####'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the
pattern removal operation is applied to each positional parame-
the beginning of the value of _p_a_r_a_m_e_t_e_r, then the result of the
expansion is the expanded value of _p_a_r_a_m_e_t_e_r with the shortest
matching pattern (the ``##'' case) or the longest matching pat-
tern (the ``####'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the
pattern removal operation is applied to each positional parame-
ter in turn, and the expansion is the resultant list. If _p_a_r_a_m_-
_e_t_e_r is an array variable subscripted with @@ or **, the pattern
removal operation is applied to each member of the array in
_e_t_e_r is an array variable subscripted with @@ or **, the pattern
removal operation is applied to each member of the array in
turn, and the expansion is the resultant list.
${_p_a_r_a_m_e_t_e_r%%_w_o_r_d}
${_p_a_r_a_m_e_t_e_r%%%%_w_o_r_d}
RReemmoovvee mmaattcchhiinngg ssuuffffiixx ppaatttteerrnn.. The _w_o_r_d is expanded to produce
a pattern just as in pathname expansion. If the pattern matches
a trailing portion of the expanded value of _p_a_r_a_m_e_t_e_r, then the
result of the expansion is the expanded value of _p_a_r_a_m_e_t_e_r with
the shortest matching pattern (the ``%%'' case) or the longest
matching pattern (the ``%%%%'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@
or **, the pattern removal operation is applied to each posi-
tional parameter in turn, and the expansion is the resultant
list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or
**, the pattern removal operation is applied to each member of
a trailing portion of the expanded value of _p_a_r_a_m_e_t_e_r, then the
result of the expansion is the expanded value of _p_a_r_a_m_e_t_e_r with
the shortest matching pattern (the ``%%'' case) or the longest
matching pattern (the ``%%%%'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@
or **, the pattern removal operation is applied to each posi-
tional parameter in turn, and the expansion is the resultant
list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or
**, the pattern removal operation is applied to each member of
the array in turn, and the expansion is the resultant list.
${_p_a_r_a_m_e_t_e_r//_p_a_t_t_e_r_n//_s_t_r_i_n_g}
PPaatttteerrnn ssuubbssttiittuuttiioonn.. The _p_a_t_t_e_r_n is expanded to produce a pat-
tern just as in pathname expansion. _P_a_r_a_m_e_t_e_r is expanded and
the longest match of _p_a_t_t_e_r_n against its value is replaced with
_s_t_r_i_n_g. If _p_a_t_t_e_r_n begins with //, all matches of _p_a_t_t_e_r_n are
replaced with _s_t_r_i_n_g. Normally only the first match is
tern just as in pathname expansion. _P_a_r_a_m_e_t_e_r is expanded and
the longest match of _p_a_t_t_e_r_n against its value is replaced with
_s_t_r_i_n_g. If _p_a_t_t_e_r_n begins with //, all matches of _p_a_t_t_e_r_n are
replaced with _s_t_r_i_n_g. Normally only the first match is
replaced. If _p_a_t_t_e_r_n begins with ##, it must match at the begin-
ning of the expanded value of _p_a_r_a_m_e_t_e_r. If _p_a_t_t_e_r_n begins with
%%, it must match at the end of the expanded value of _p_a_r_a_m_e_t_e_r.
%%, it must match at the end of the expanded value of _p_a_r_a_m_e_t_e_r.
If _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted and the // fol-
lowing _p_a_t_t_e_r_n may be omitted. If _p_a_r_a_m_e_t_e_r is @@ or **, the sub-
stitution operation is applied to each positional parameter in
turn, and the expansion is the resultant list. If _p_a_r_a_m_e_t_e_r is
an array variable subscripted with @@ or **, the substitution
operation is applied to each member of the array in turn, and
stitution operation is applied to each positional parameter in
turn, and the expansion is the resultant list. If _p_a_r_a_m_e_t_e_r is
an array variable subscripted with @@ or **, the substitution
operation is applied to each member of the array in turn, and
the expansion is the resultant list.
${_p_a_r_a_m_e_t_e_r^^_p_a_t_t_e_r_n}
${_p_a_r_a_m_e_t_e_r^^^^_p_a_t_t_e_r_n}
${_p_a_r_a_m_e_t_e_r,,_p_a_t_t_e_r_n}
${_p_a_r_a_m_e_t_e_r,,,,_p_a_t_t_e_r_n}
CCaassee mmooddiiffiiccaattiioonn.. This expansion modifies the case of alpha-
betic characters in _p_a_r_a_m_e_t_e_r. The _p_a_t_t_e_r_n is expanded to pro-
duce a pattern just as in pathname expansion. The ^^ operator
converts lowercase letters matching _p_a_t_t_e_r_n 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 _p_a_t_t_e_r_n is omitted, it is treated like
a ??, which matches every character. If _p_a_r_a_m_e_t_e_r is @@ or **, the
case modification operation is applied to each positional param-
eter in turn, and the expansion is the resultant list. If
_p_a_r_a_m_e_t_e_r 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.
CCaassee mmooddiiffiiccaattiioonn.. This expansion modifies the case of alpha-
betic characters in _p_a_r_a_m_e_t_e_r. The _p_a_t_t_e_r_n is expanded to pro-
duce a pattern just as in pathname expansion. The ^^ operator
converts lowercase letters matching _p_a_t_t_e_r_n 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 in the expanded value.. If _p_a_t_t_e_r_n is omit-
ted, it is treated like a ??, which matches every character. If
_p_a_r_a_m_e_t_e_r is @@ or **, the case modification operation is applied
to each positional parameter in turn, and the expansion is the
resultant list. If _p_a_r_a_m_e_t_e_r 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.
CCoommmmaanndd SSuubbssttiittuuttiioonn
_C_o_m_m_a_n_d _s_u_b_s_t_i_t_u_t_i_o_n allows the output of a command to replace the com-
@@ -2311,6 +2315,10 @@ CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENN
executed in a subshell environment. Changes made to the subshell envi-
ronment cannot affect the shell's execution environment.
Subshells spawned to execute command substitutions inherit the value of
the --ee option from the parent shell. When not in posix mode, Bash
clears the --ee option in such subshells.
If a command is followed by a && and job control is not active, the
default standard input for the command is the empty file _/_d_e_v_/_n_u_l_l.
Otherwise, the invoked command inherits the file descriptors of the
@@ -4285,6 +4293,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
llooggoouutt Exit a login shell.
mmaappffiillee [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
rreeaaddaarrrraayy [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
Read lines from the standard input into array variable _a_r_r_a_y, or
from file descriptor _f_d if the --uu option is supplied. The vari-
@@ -4303,7 +4313,11 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--cc Specify the number of lines read between each call to
_c_a_l_l_b_a_c_k.
If --CC is specified without --cc, the default quantum is 5000.
If --CC is specified without --cc, the default quantum is 5000.
When _c_a_l_l_b_a_c_k is evaluated, it is supplied the index of the next
array element to be assigned as an additional argument. _c_a_l_l_-
_b_a_c_k is evaluated after the line is read but before the array
element is assigned.
If not supplied with an explicit origin, mmaappffiillee will clear
_a_r_r_a_y before assigning to it.
@@ -5194,16 +5208,10 @@ BBUUGGSS
parentheses to force it into a subshell, which may be stopped as a
unit.
Commands inside of $$((...)) 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.
Array variables may not (yet) be exported.
There may be only one active coprocess at a time.
GNU Bash-4.0 2008 October 28 BASH(1)
GNU Bash-4.0 2008 December 29 BASH(1)