mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 18:22:25 +02:00
commit bash-20180720 snapshot
This commit is contained in:
+40
-38
@@ -382,24 +382,24 @@ SSHHEELLLL GGRRAAMMMMAARR
|
||||
|
||||
An additional binary operator, ==~~, is available, with the same
|
||||
precedence as ==== and !!==. When it is used, the string to the
|
||||
right of the operator is considered an extended regular expres-
|
||||
sion and matched accordingly (as in _r_e_g_e_x(3)). 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 nnooccaasseemmaattcchh shell option
|
||||
is enabled, the match is performed without regard to the case of
|
||||
alphabetic characters. Any part of the pattern may be quoted to
|
||||
force the quoted portion to be matched as a string. Bracket
|
||||
expressions in regular expressions must be treated carefully,
|
||||
since normal quoting characters lose their meanings between
|
||||
brackets. If the pattern is stored in a shell variable, quoting
|
||||
the variable expansion forces the entire pattern to be matched
|
||||
as a string. Substrings matched by parenthesized subexpressions
|
||||
within the regular expression are saved in the array variable
|
||||
BBAASSHH__RREEMMAATTCCHH. The element of BBAASSHH__RREEMMAATTCCHH with index 0 is the
|
||||
portion of the string matching the entire regular expression.
|
||||
The element of BBAASSHH__RREEMMAATTCCHH with index _n is the portion of the
|
||||
string matching the _nth parenthesized subexpression.
|
||||
right of the operator is considered a POSIX extended regular
|
||||
expression and matched accordingly (as in _r_e_g_e_x(3)). The return
|
||||
value is 0 if the string matches the pattern, and 1 otherwise.
|
||||
If the regular expression is syntactically incorrect, the condi-
|
||||
tional expression's return value is 2. If the nnooccaasseemmaattcchh shell
|
||||
option is enabled, the match is performed without regard to the
|
||||
case of alphabetic characters. Any part of the pattern may be
|
||||
quoted to force the quoted portion to be matched as a string.
|
||||
Bracket expressions in regular expressions must be treated care-
|
||||
fully, since normal quoting characters lose their meanings
|
||||
between brackets. If the pattern is stored in a shell variable,
|
||||
quoting the variable expansion forces the entire pattern to be
|
||||
matched as a string. Substrings matched by parenthesized subex-
|
||||
pressions within the regular expression are saved in the array
|
||||
variable BBAASSHH__RREEMMAATTCCHH. The element of BBAASSHH__RREEMMAATTCCHH with index 0
|
||||
is the portion of the string matching the entire regular expres-
|
||||
sion. The element of BBAASSHH__RREEMMAATTCCHH 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:
|
||||
@@ -812,18 +812,20 @@ PPAARRAAMMEETTEERRSS
|
||||
is pushed onto BBAASSHH__AARRGGCC. The shell sets BBAASSHH__AARRGGCC only when in
|
||||
extended debugging mode (see the description of the eexxttddeebbuugg
|
||||
option to the sshhoopptt builtin below). Setting eexxttddeebbuugg after the
|
||||
shell has started to execute a script may result in inconsistent
|
||||
values.
|
||||
shell has started to execute a script, or referencing this vari-
|
||||
able when eexxttddeebbuugg is not set, may result in inconsistent val-
|
||||
ues.
|
||||
BBAASSHH__AARRGGVV
|
||||
An array variable containing all of the parameters in the cur-
|
||||
An array variable containing all of the parameters in the cur-
|
||||
rent bbaasshh execution call stack. The final parameter of the last
|
||||
subroutine call is at the top of the stack; the first parameter
|
||||
subroutine call is at the top of the stack; the first parameter
|
||||
of the initial call is at the bottom. When a subroutine is exe-
|
||||
cuted, the parameters supplied are pushed onto BBAASSHH__AARRGGVV. The
|
||||
shell sets BBAASSHH__AARRGGVV only when in extended debugging mode (see
|
||||
the description of the eexxttddeebbuugg option to the sshhoopptt builtin
|
||||
cuted, the parameters supplied are pushed onto BBAASSHH__AARRGGVV. The
|
||||
shell sets BBAASSHH__AARRGGVV only when in extended debugging mode (see
|
||||
the description of the eexxttddeebbuugg option to the sshhoopptt builtin
|
||||
below). Setting eexxttddeebbuugg after the shell has started to execute
|
||||
a script may result in inconsistent values.
|
||||
a script, or referencing this variable when eexxttddeebbuugg is not set,
|
||||
may result in inconsistent values.
|
||||
BBAASSHH__AARRGGVV00
|
||||
When referenced, this variable expands to the name of the shell
|
||||
or shell script (identical to $$00; see the description of special
|
||||
@@ -1603,18 +1605,18 @@ EEXXPPAANNSSIIOONN
|
||||
(AArrrraayyss).
|
||||
|
||||
If the first character of _p_a_r_a_m_e_t_e_r is an exclamation point (!!), and
|
||||
_p_a_r_a_m_e_t_e_r is not a _n_a_m_e_r_e_f, it introduces a level of variable indirec-
|
||||
tion. BBaasshh uses the value of the variable formed from the rest of
|
||||
_p_a_r_a_m_e_t_e_r as the name of the variable; this variable is then expanded
|
||||
and that value is used in the rest of the substitution, rather than the
|
||||
value of _p_a_r_a_m_e_t_e_r itself. This is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The
|
||||
value is subject to tilde expansion, parameter expansion, command sub-
|
||||
stitution, and arithmetic expansion. If _p_a_r_a_m_e_t_e_r is a nameref, this
|
||||
expands to the name of the variable referenced by _p_a_r_a_m_e_t_e_r instead of
|
||||
performing the complete indirect expansion. The exceptions to this are
|
||||
the expansions of ${!!_p_r_e_f_i_x**} and ${!!_n_a_m_e[_@]} described below. The
|
||||
exclamation point must immediately follow the left brace in order to
|
||||
introduce indirection.
|
||||
_p_a_r_a_m_e_t_e_r is not a _n_a_m_e_r_e_f, it introduces a level of indirection. BBaasshh
|
||||
uses the value formed by expanding the rest of _p_a_r_a_m_e_t_e_r as the new
|
||||
_p_a_r_a_m_e_t_e_r; this is then expanded and that value is used in the rest of
|
||||
the expansion, rather than the expansion of the original _p_a_r_a_m_e_t_e_r.
|
||||
This is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The value is subject to tilde
|
||||
expansion, parameter expansion, command substitution, and arithmetic
|
||||
expansion. If _p_a_r_a_m_e_t_e_r is a nameref, this expands to the name of the
|
||||
parameter referenced by _p_a_r_a_m_e_t_e_r instead of performing the complete
|
||||
indirect expansion. The exceptions to this are the expansions of
|
||||
${!!_p_r_e_f_i_x**} and ${!!_n_a_m_e[_@]} described below. The exclamation point
|
||||
must immediately follow the left brace in order to introduce indirec-
|
||||
tion.
|
||||
|
||||
In each of the cases below, _w_o_r_d is subject to tilde expansion, parame-
|
||||
ter expansion, command substitution, and arithmetic expansion.
|
||||
|
||||
Reference in New Issue
Block a user