mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-10 21:50:49 +02:00
commit bash-20180316 snapshot
This commit is contained in:
+143
-135
@@ -457,24 +457,24 @@ SSHHEELLLL GGRRAAMMMMAARR
|
||||
|
||||
ccaassee _w_o_r_d iinn [ [(] _p_a_t_t_e_r_n [ || _p_a_t_t_e_r_n ] ... ) _l_i_s_t ;; ] ... eessaacc
|
||||
A ccaassee command first expands _w_o_r_d, and tries to match it against
|
||||
each _p_a_t_t_e_r_n in turn, using the same matching rules as for path-
|
||||
name expansion (see PPaatthhnnaammee EExxppaannssiioonn below). The _w_o_r_d is
|
||||
expanded using tilde expansion, parameter and variable expan-
|
||||
sion, arithmetic expansion, command substitution, process sub-
|
||||
stitution and quote removal. Each _p_a_t_t_e_r_n examined is expanded
|
||||
using tilde expansion, parameter and variable expansion, arith-
|
||||
metic expansion, command substitution, and process substitution.
|
||||
If the nnooccaasseemmaattcchh shell option is enabled, the match is per-
|
||||
formed without regard to the case of alphabetic characters.
|
||||
When a match is found, the corresponding _l_i_s_t is executed. 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 _l_i_s_t associated with the next set
|
||||
of patterns. Using ;;;;&& in place of ;;;; causes the shell to test
|
||||
the next pattern list in the statement, if any, and execute any
|
||||
associated _l_i_s_t 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 _l_i_s_t.
|
||||
each _p_a_t_t_e_r_n in turn, using the matching rules described under
|
||||
PPaatttteerrnn MMaattcchhiinngg below. The _w_o_r_d is expanded using tilde expan-
|
||||
sion, parameter and variable expansion, arithmetic expansion,
|
||||
command substitution, process substitution and quote removal.
|
||||
Each _p_a_t_t_e_r_n examined is expanded using tilde expansion, parame-
|
||||
ter and variable expansion, arithmetic expansion, command sub-
|
||||
stitution, and process substitution. If the nnooccaasseemmaattcchh shell
|
||||
option is enabled, the match is performed without regard to the
|
||||
case of alphabetic characters. When a match is found, the cor-
|
||||
responding _l_i_s_t is executed. 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
|
||||
_l_i_s_t associated with the next set of patterns. Using ;;;;&& in
|
||||
place of ;;;; causes the shell to test the next pattern list in
|
||||
the statement, if any, and execute any associated _l_i_s_t on a suc-
|
||||
cessful match. The exit status is zero if no pattern matches.
|
||||
Otherwise, it is the exit status of the last command executed in
|
||||
_l_i_s_t.
|
||||
|
||||
iiff _l_i_s_t; tthheenn _l_i_s_t; [ eelliiff _l_i_s_t; tthheenn _l_i_s_t; ] ... [ eellssee _l_i_s_t; ] ffii
|
||||
The iiff _l_i_s_t is executed. If its exit status is zero, the tthheenn
|
||||
@@ -1710,100 +1710,105 @@ EEXXPPAANNSSIIOONN
|
||||
${_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
|
||||
a pattern just as in pathname expansion, and matched against the
|
||||
expanded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatt--
|
||||
tteerrnn MMaattcchhiinngg below. 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 pattern (the ``####''
|
||||
case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the pattern removal
|
||||
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 pattern removal operation
|
||||
is applied to each member of the array in turn, and the expan-
|
||||
sion 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, and matched against the
|
||||
expanded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatt--
|
||||
tteerrnn MMaattcchhiinngg below. 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 pat-
|
||||
tern (the ``####'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the
|
||||
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
|
||||
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
|
||||
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
|
||||
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.
|
||||
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 the nnooccaasseemmaattcchh shell option
|
||||
is enabled, the match is performed without regard to the case of
|
||||
alphabetic characters. If _p_a_r_a_m_e_t_e_r is @@ or **, the substitution
|
||||
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.
|
||||
_s_t_r_i_n_g. The match is performed using the rules described under
|
||||
PPaatttteerrnn MMaattcchhiinngg below. 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 beginning 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. If _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted
|
||||
and the // following _p_a_t_t_e_r_n may be omitted. If the nnooccaasseemmaattcchh
|
||||
shell option is enabled, the match is performed without regard
|
||||
to the case of alphabetic characters. If _p_a_r_a_m_e_t_e_r is @@ or **,
|
||||
the substitution 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 substitu-
|
||||
tion 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-
|
||||
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. Each character in
|
||||
the expanded value of _p_a_r_a_m_e_t_e_r is tested against _p_a_t_t_e_r_n, and,
|
||||
if it matches the pattern, its case is converted. The pattern
|
||||
should not attempt to match more than one character. The ^^
|
||||
operator converts lowercase letters matching _p_a_t_t_e_r_n to upper-
|
||||
the expanded value of _p_a_r_a_m_e_t_e_r is tested against _p_a_t_t_e_r_n, and,
|
||||
if it matches the pattern, its case is converted. The pattern
|
||||
should not attempt to match more than one character. The ^^
|
||||
operator converts lowercase letters matching _p_a_t_t_e_r_n to upper-
|
||||
case; the ,, operator converts matching uppercase letters to low-
|
||||
ercase. 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
|
||||
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 parameter in turn, and the expansion
|
||||
is the resultant list. If _p_a_r_a_m_e_t_e_r is an array variable sub-
|
||||
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
|
||||
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 parameter in turn, and the expansion
|
||||
is the resultant list. If _p_a_r_a_m_e_t_e_r is an array variable sub-
|
||||
scripted with @@ or **, the case modification operation is applied
|
||||
to each member of the array in turn, and the expansion is the
|
||||
to each member of the array in turn, and the expansion is the
|
||||
resultant list.
|
||||
|
||||
${_p_a_r_a_m_e_t_e_r@@_o_p_e_r_a_t_o_r}
|
||||
PPaarraammeetteerr ttrraannssffoorrmmaattiioonn. The expansion is either a transforma-
|
||||
tion of the value of _p_a_r_a_m_e_t_e_r or information about _p_a_r_a_m_e_t_e_r
|
||||
itself, depending on the value of _o_p_e_r_a_t_o_r. Each _o_p_e_r_a_t_o_r is a
|
||||
tion of the value of _p_a_r_a_m_e_t_e_r or information about _p_a_r_a_m_e_t_e_r
|
||||
itself, depending on the value of _o_p_e_r_a_t_o_r. Each _o_p_e_r_a_t_o_r is a
|
||||
single letter:
|
||||
|
||||
QQ The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
QQ The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
quoted in a format that can be reused as input.
|
||||
EE The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
with backslash escape sequences expanded as with the
|
||||
EE The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
with backslash escape sequences expanded as with the
|
||||
$$''......'' quoting mechanism.
|
||||
PP The expansion is a string that is the result of expanding
|
||||
the value of _p_a_r_a_m_e_t_e_r as if it were a prompt string (see
|
||||
PPRROOMMPPTTIINNGG below).
|
||||
AA The expansion is a string in the form of an assignment
|
||||
statement or ddeeccllaarree command that, if evaluated, will
|
||||
AA The expansion is a string in the form of an assignment
|
||||
statement or ddeeccllaarree command that, if evaluated, will
|
||||
recreate _p_a_r_a_m_e_t_e_r with its attributes and value.
|
||||
aa The expansion is a string consisting of flag values rep-
|
||||
aa The expansion is a string consisting of flag values rep-
|
||||
resenting _p_a_r_a_m_e_t_e_r's attributes.
|
||||
|
||||
If _p_a_r_a_m_e_t_e_r is @@ or **, the 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
|
||||
If _p_a_r_a_m_e_t_e_r is @@ or **, the 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 operation is applied to each member of the array in turn,
|
||||
and the expansion is the resultant list.
|
||||
|
||||
The result of the expansion is subject to word splitting and
|
||||
The result of the expansion is subject to word splitting and
|
||||
pathname expansion as described below.
|
||||
|
||||
CCoommmmaanndd SSuubbssttiittuuttiioonn
|
||||
@@ -1817,106 +1822,109 @@ EEXXPPAANNSSIIOONN
|
||||
BBaasshh performs the expansion by executing _c_o_m_m_a_n_d in a subshell environ-
|
||||
ment and replacing the command substitution with the standard output of
|
||||
the command, with any trailing newlines deleted. Embedded newlines are
|
||||
not deleted, but they may be removed during word splitting. The com-
|
||||
mand substitution $$((ccaatt _f_i_l_e)) can be replaced by the equivalent but
|
||||
not deleted, but they may be removed during word splitting. The com-
|
||||
mand substitution $$((ccaatt _f_i_l_e)) can be replaced by the equivalent but
|
||||
faster $$((<< _f_i_l_e)).
|
||||
|
||||
When the old-style backquote form of substitution is used, backslash
|
||||
retains its literal meaning except when followed by $$, ``, or \\. The
|
||||
When the old-style backquote form of substitution is used, backslash
|
||||
retains its literal meaning except when followed by $$, ``, or \\. The
|
||||
first backquote not preceded by a backslash terminates the command sub-
|
||||
stitution. When using the $(_c_o_m_m_a_n_d) form, all characters between the
|
||||
stitution. When using the $(_c_o_m_m_a_n_d) form, all characters between the
|
||||
parentheses make up the command; none are treated specially.
|
||||
|
||||
Command substitutions may be nested. To nest when using the backquoted
|
||||
form, escape the inner backquotes with backslashes.
|
||||
|
||||
If the substitution appears within double quotes, word splitting and
|
||||
If the substitution appears within double quotes, word splitting and
|
||||
pathname expansion are not performed on the results.
|
||||
|
||||
AArriitthhmmeettiicc EExxppaannssiioonn
|
||||
Arithmetic expansion allows the evaluation of an arithmetic expression
|
||||
and the substitution of the result. The format for arithmetic expan-
|
||||
Arithmetic expansion allows the evaluation of an arithmetic expression
|
||||
and the substitution of the result. The format for arithmetic expan-
|
||||
sion is:
|
||||
|
||||
$$((((_e_x_p_r_e_s_s_i_o_n))))
|
||||
|
||||
The _e_x_p_r_e_s_s_i_o_n is treated as if it were within double quotes, but a
|
||||
double quote inside the parentheses is not treated specially. All
|
||||
The _e_x_p_r_e_s_s_i_o_n is treated as if it were within double quotes, but a
|
||||
double quote inside the parentheses is not treated specially. All
|
||||
tokens in the expression undergo parameter and variable expansion, com-
|
||||
mand substitution, and quote removal. The result is treated as the
|
||||
arithmetic expression to be evaluated. Arithmetic expansions may be
|
||||
mand substitution, and quote removal. The result is treated as the
|
||||
arithmetic expression to be evaluated. Arithmetic expansions may be
|
||||
nested.
|
||||
|
||||
The evaluation is performed according to the rules listed below under
|
||||
The evaluation is performed according to the rules listed below under
|
||||
AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If _e_x_p_r_e_s_s_i_o_n is invalid, bbaasshh prints a message
|
||||
indicating failure and no substitution occurs.
|
||||
|
||||
PPrroocceessss SSuubbssttiittuuttiioonn
|
||||
_P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n allows a process's input or output to be referred
|
||||
to using a filename. It takes the form of <<((_l_i_s_t)) or >>((_l_i_s_t)). The
|
||||
process _l_i_s_t is run asynchronously, and its input or output appears as
|
||||
_P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n allows a process's input or output to be referred
|
||||
to using a filename. It takes the form of <<((_l_i_s_t)) or >>((_l_i_s_t)). The
|
||||
process _l_i_s_t is run asynchronously, and its input or output appears as
|
||||
a filename. This filename is passed as an argument to the current com-
|
||||
mand as the result of the expansion. If the >>((_l_i_s_t)) form is used,
|
||||
writing to the file will provide input for _l_i_s_t. If the <<((_l_i_s_t)) form
|
||||
is used, the file passed as an argument should be read to obtain the
|
||||
mand as the result of the expansion. If the >>((_l_i_s_t)) form is used,
|
||||
writing to the file will provide input for _l_i_s_t. If the <<((_l_i_s_t)) form
|
||||
is used, the file passed as an argument should be read to obtain the
|
||||
output of _l_i_s_t. Process substitution is supported on systems that sup-
|
||||
port named pipes (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open files.
|
||||
|
||||
When available, process substitution is performed simultaneously with
|
||||
parameter and variable expansion, command substitution, and arithmetic
|
||||
When available, process substitution is performed simultaneously with
|
||||
parameter and variable expansion, command substitution, and arithmetic
|
||||
expansion.
|
||||
|
||||
WWoorrdd SSpplliittttiinngg
|
||||
The shell scans the results of parameter expansion, command substitu-
|
||||
tion, and arithmetic expansion that did not occur within double quotes
|
||||
The shell scans the results of parameter expansion, command substitu-
|
||||
tion, and arithmetic expansion that did not occur within double quotes
|
||||
for _w_o_r_d _s_p_l_i_t_t_i_n_g.
|
||||
|
||||
The shell treats each character of IIFFSS as a delimiter, and splits the
|
||||
results of the other expansions into words using these characters as
|
||||
field terminators. If IIFFSS is unset, or its value is exactly
|
||||
<<ssppaaccee>><<ttaabb>><<nneewwlliinnee>>, the default, then sequences of <<ssppaaccee>>, <<ttaabb>>,
|
||||
and <<nneewwlliinnee>> at the beginning and end of the results of the previous
|
||||
expansions are ignored, and any sequence of IIFFSS characters not at the
|
||||
beginning or end serves to delimit words. If IIFFSS has a value other
|
||||
than the default, then sequences of the whitespace characters ssppaaccee,
|
||||
ttaabb, and nneewwlliinnee are ignored at the beginning and end of the word, as
|
||||
long as the whitespace character is in the value of IIFFSS (an IIFFSS white-
|
||||
space character). Any character in IIFFSS that is not IIFFSS whitespace,
|
||||
The shell treats each character of IIFFSS as a delimiter, and splits the
|
||||
results of the other expansions into words using these characters as
|
||||
field terminators. If IIFFSS is unset, or its value is exactly
|
||||
<<ssppaaccee>><<ttaabb>><<nneewwlliinnee>>, the default, then sequences of <<ssppaaccee>>, <<ttaabb>>,
|
||||
and <<nneewwlliinnee>> at the beginning and end of the results of the previous
|
||||
expansions are ignored, and any sequence of IIFFSS characters not at the
|
||||
beginning or end serves to delimit words. If IIFFSS has a value other
|
||||
than the default, then sequences of the whitespace characters ssppaaccee,
|
||||
ttaabb, and nneewwlliinnee are ignored at the beginning and end of the word, as
|
||||
long as the whitespace character is in the value of IIFFSS (an IIFFSS white-
|
||||
space character). Any character in IIFFSS that is not IIFFSS whitespace,
|
||||
along with any adjacent IIFFSS whitespace characters, delimits a field. A
|
||||
sequence of IIFFSS whitespace characters is also treated as a delimiter.
|
||||
sequence of IIFFSS whitespace characters is also treated as a delimiter.
|
||||
If the value of IIFFSS is null, no word splitting occurs.
|
||||
|
||||
Explicit null arguments ("""" or '''') are retained and passed to commands
|
||||
Explicit null arguments ("""" or '''') are retained and passed to commands
|
||||
as empty strings. Unquoted implicit null arguments, resulting from the
|
||||
expansion of parameters that have no values, are removed. If a parame-
|
||||
ter with no value is expanded within double quotes, a null argument
|
||||
results and is retained and passed to a command as an empty string.
|
||||
When a quoted null argument appears as part of a word whose expansion
|
||||
is non-null, the null argument is removed. That is, the word -d''
|
||||
ter with no value is expanded within double quotes, a null argument
|
||||
results and is retained and passed to a command as an empty string.
|
||||
When a quoted null argument appears as part of a word whose expansion
|
||||
is non-null, the null argument is removed. That is, the word -d''
|
||||
becomes -d after word splitting and null argument removal.
|
||||
|
||||
Note that if no expansion occurs, no splitting is performed.
|
||||
|
||||
PPaatthhnnaammee EExxppaannssiioonn
|
||||
After word splitting, unless the --ff option has been set, bbaasshh scans
|
||||
each word for the characters **, ??, and [[. If one of these characters
|
||||
appears, then the word is regarded as a _p_a_t_t_e_r_n, and replaced with an
|
||||
alphabetically sorted list of filenames matching the pattern (see PPaatt--
|
||||
tteerrnn MMaattcchhiinngg below). If no matching filenames are found, and the
|
||||
shell option nnuullllgglloobb is not enabled, the word is left unchanged. If
|
||||
the nnuullllgglloobb option is set, and no matches are found, the word is
|
||||
removed. If the ffaaiillgglloobb shell option is set, and no matches are
|
||||
After word splitting, unless the --ff option has been set, bbaasshh scans
|
||||
each word for the characters **, ??, and [[. If one of these characters
|
||||
appears, then the word is regarded as a _p_a_t_t_e_r_n, and replaced with an
|
||||
alphabetically sorted list of filenames matching the pattern (see PPaatt--
|
||||
tteerrnn MMaattcchhiinngg below). If no matching filenames are found, and the
|
||||
shell option nnuullllgglloobb is not enabled, the word is left unchanged. If
|
||||
the nnuullllgglloobb option is set, and no matches are found, the word is
|
||||
removed. If the ffaaiillgglloobb shell option is set, and no matches are
|
||||
found, an error message is printed and the command is not executed. If
|
||||
the shell option nnooccaasseegglloobb is enabled, the match is performed without
|
||||
regard to the case of alphabetic characters. When a pattern is used
|
||||
for pathname expansion, the character ````..'''' at the start of a name or
|
||||
immediately following a slash must be matched explicitly, unless the
|
||||
shell option ddoottgglloobb is set. The filenames ````..'''' and ````....'''' must
|
||||
always be matched explicitly, even if ddoottgglloobb is set. When matching a
|
||||
pathname, the slash character must always be matched explicitly. In
|
||||
other cases, the ````..'''' character is not treated specially. See the
|
||||
description of sshhoopptt below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS for a descrip-
|
||||
tion of the nnooccaasseegglloobb, nnuullllgglloobb, ffaaiillgglloobb, and ddoottgglloobb shell options.
|
||||
the shell option nnooccaasseegglloobb is enabled, the match is performed without
|
||||
regard to the case of alphabetic characters. When a pattern is used
|
||||
for pathname expansion, the character ````..'''' at the start of a name or
|
||||
immediately following a slash must be matched explicitly, unless the
|
||||
shell option ddoottgglloobb is set. The filenames ````..'''' and ````....'''' must
|
||||
always be matched explicitly, even if ddoottgglloobb is set. In other cases,
|
||||
the ````..'''' character is not treated specially. When matching a path-
|
||||
name, the slash character must always be matched explicitly by a slash
|
||||
in the pattern, but in other matching contexts it can be matched by a
|
||||
special pattern character as described below under PPaatttteerrnn MMaattcchhiinngg.
|
||||
See the description of sshhoopptt below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS for a
|
||||
description of the nnooccaasseegglloobb, nnuullllgglloobb, ffaaiillgglloobb, and ddoottgglloobb shell
|
||||
options.
|
||||
|
||||
The GGLLOOBBIIGGNNOORREE shell variable may be used to restrict the set of file
|
||||
names matching a _p_a_t_t_e_r_n. If GGLLOOBBIIGGNNOORREE is set, each matching file
|
||||
@@ -6106,4 +6114,4 @@ BBUUGGSS
|
||||
|
||||
|
||||
|
||||
GNU Bash 4.4 2018 March 2 BASH(1)
|
||||
GNU Bash 5.0 2018 March 15 BASH(1)
|
||||
|
||||
Reference in New Issue
Block a user