commit bash-20180316 snapshot

This commit is contained in:
Chet Ramey
2018-03-19 09:46:55 -04:00
parent bf5b8103d4
commit f602026a0c
59 changed files with 6880 additions and 6405 deletions
+19
View File
@@ -15068,4 +15068,23 @@ variables.c
discussion started by Nikolai Kondrashov <spbnick@gmail.com> back
on 2/11/2018
3/13
----
subst.c
- expand_word_list_internal: short-circuit and exit right away if a
variable assignment preceding a special builtin fails in posix mode
- expand_word_list_internal: if a variable assignment precedes an
empty command name (after expansion), fix to exit right away when
the shell is in posix mode
3/15
----
doc/{bash.1,bashref.texi}
- Add text to Pathname Expansion clarifying that a slash must be
matched by a slash in the pattern when matching pathnames, but
not in other matching contexts. Suggested by <stormy1777@yahoo.com>
builtins/common.c
- read_octal: allow octal numbers greater than 777 to accommodate
modes and umasks that include sticky/setuid/setgid bits. Report
and fix from Martijn Dekker <martijn@inlv.org>
+5
View File
@@ -980,6 +980,7 @@ tests/errors3.sub f
tests/errors4.sub f
tests/errors5.sub f
tests/errors6.sub f
tests/errors7.sub f
tests/execscript f
tests/exec.right f
tests/exec1.sub f 755
@@ -1008,6 +1009,7 @@ tests/exp8.sub f
tests/exp9.sub f
tests/exp10.sub f
tests/exp11.sub f
tests/exp12.sub f
tests/exportfunc.tests f
tests/exportfunc.right f
tests/exportfunc1.sub f
@@ -1024,6 +1026,7 @@ tests/extglob3.sub f
tests/extglob3.tests f
tests/extglob3.right f
tests/extglob4.sub f
tests/extglob5.sub f
tests/func.tests f
tests/func.right f
tests/func1.sub f
@@ -1139,6 +1142,7 @@ tests/new-exp7.sub f
tests/new-exp8.sub f
tests/new-exp9.sub f
tests/new-exp10.sub f
tests/new-exp11.sub f
tests/new-exp.right f
tests/nquote.tests f
tests/nquote.right f
@@ -1351,6 +1355,7 @@ tests/varenv7.sub f
tests/varenv8.sub f
tests/varenv9.sub f
tests/varenv10.sub f
tests/varenv11.sub f
tests/version f
tests/version.mini f
tests/vredir.tests f
+2 -2
View File
@@ -1,4 +1,4 @@
# Makefile for bash-5.0, version 4.23
# Makefile for bash-5.0, version 4.25
#
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
@@ -609,7 +609,7 @@ asan:
# cheating
gcov:
${MAKE} ${MFLAGS} ADDON_CFLAGS='${GCOV_XCFLAGS}' ADDON_LDFLAGS='${GCOV_XLDFLAGS}' .made
${MAKE} ${MFLAGS} CFLAGS=-g ADDON_CFLAGS='${GCOV_XCFLAGS}' ADDON_LDFLAGS='${GCOV_XLDFLAGS}' .made
# have to make this separate because making tests depend on $(PROGRAM)
+1 -1
View File
@@ -537,7 +537,7 @@ read_octal (string)
{
digits++;
result = (result * 8) + (*string++ - '0');
if (result > 0777)
if (result > 07777)
return -1;
}
+143 -135
View File
@@ -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)
+33 -11
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Fri Mar 2 16:07:55 EST 2018
.\" Last Change: Thu Mar 15 11:30:03 EDT 2018
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2018 March 2" "GNU Bash 4.4"
.TH BASH 1 "2018 March 15" "GNU Bash 5.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -869,10 +869,10 @@ or zero if no commands were executed.
\fBcase\fP \fIword\fP \fBin\fP [ [(] \fIpattern\fP [ \fB|\fP \fIpattern\fP ] \
... ) \fIlist\fP ;; ] ... \fBesac\fP
A \fBcase\fP command first expands \fIword\fP, and tries to match
it against each \fIpattern\fP in turn, using the same matching rules
as for pathname expansion (see
.B Pathname Expansion
below).
it against each \fIpattern\fP in turn, using the matching rules
described under
.B Pattern Matching
below.
The \fIword\fP is expanded using tilde
expansion, parameter and variable expansion, arithmetic expansion,
command substitution, process substitution and quote removal.
@@ -3127,7 +3127,12 @@ ${\fIparameter\fP\fB##\fP\fIword\fP}
The
.I word
is expanded to produce a pattern just as in pathname
expansion. If the pattern matches the beginning of
expansion, and matched against the expanded value of
.I parameter
using the rules described under
.B Pattern Matching
below.
If the pattern matches the beginning of
the value of
.IR parameter ,
then the result of the expansion is the expanded value of
@@ -3158,7 +3163,11 @@ ${\fIparameter\fP\fB%%\fP\fIword\fP}
.PD
\fBRemove matching suffix pattern\fP.
The \fIword\fP is expanded to produce a pattern just as in
pathname expansion.
pathname expansion, and matched against the expanded value of
.I parameter
using the rules described under
.B Pattern Matching
below.
If the pattern matches a trailing portion of the expanded value of
.IR parameter ,
then the result of the expansion is the expanded value of
@@ -3185,9 +3194,12 @@ array in turn, and the expansion is the resultant list.
${\fIparameter\fP\fB/\fP\fIpattern\fP\fB/\fP\fIstring\fP}
\fBPattern substitution\fP.
The \fIpattern\fP is expanded to produce a pattern just as in
pathname expansion.
pathname expansion,
\fIParameter\fP is expanded and the longest match of \fIpattern\fP
against its value is replaced with \fIstring\fP.
The match is performed using the rules described under
.B Pattern Matching
below.
If \fIpattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
replaced with \fIstring\fP. Normally only the first match is replaced.
If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
@@ -3533,11 +3545,15 @@ and
must always be matched explicitly, even if
.B dotglob
is set.
When matching a pathname, the slash character must always be
matched explicitly.
In other cases, the
.B ``.''
character is not treated specially.
When matching a pathname, 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
.SM
.BR "Pattern Matching" .
See the description of
.B shopt
below under
@@ -7814,6 +7830,12 @@ The \fIwordlist\fP is split using the characters in the
.SM
.B IFS
special variable as delimiters, and each resultant word is expanded.
Shell quoting is honored within \fIwordlist\fP,
in order to provide a
mechanism for the words to contain shell metacharacters or characters
in the value of
.SM
.BR IFS .
The possible completions are the members of the resultant list which
match the word being completed.
.TP 8
+34 -12
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2018 March 2<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2018 March 15<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -1117,11 +1117,11 @@ or zero if no commands were executed.
<DT><B>case</B> <I>word</I> <B>in</B> [ [(] <I>pattern</I> [ <B>|</B> <I>pattern</I> ]
<DD>
A <B>case</B> command first expands <I>word</I>, and tries to match
it against each <I>pattern</I> in turn, using the same matching rules
as for pathname expansion (see
<B>Pathname Expansion</B>
it against each <I>pattern</I> in turn, using the matching rules
described under
<B>Pattern Matching</B>
below).
below.
The <I>word</I> is expanded using tilde
expansion, parameter and variable expansion, arithmetic expansion,
command substitution, process substitution and quote removal.
@@ -3931,7 +3931,14 @@ The
<I>word</I>
is expanded to produce a pattern just as in pathname
expansion. If the pattern matches the beginning of
expansion, and matched against the expanded value of
<I>parameter</I>
using the rules described under
<B>Pattern Matching</B>
below.
If the pattern matches the beginning of
the value of
<I>parameter</I>,
@@ -3968,7 +3975,13 @@ array in turn, and the expansion is the resultant list.
<B>Remove matching suffix pattern</B>.
The <I>word</I> is expanded to produce a pattern just as in
pathname expansion.
pathname expansion, and matched against the expanded value of
<I>parameter</I>
using the rules described under
<B>Pattern Matching</B>
below.
If the pattern matches a trailing portion of the expanded value of
<I>parameter</I>,
@@ -4002,9 +4015,13 @@ array in turn, and the expansion is the resultant list.
<DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
<B>Pattern substitution</B>.
The <I>pattern</I> is expanded to produce a pattern just as in
pathname expansion.
pathname expansion,
<I>Parameter</I> is expanded and the longest match of <I>pattern</I>
against its value is replaced with <I>string</I>.
The match is performed using the rules described under
<B>Pattern Matching</B>
below.
If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
replaced with <I>string</I>. Normally only the first match is replaced.
If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
@@ -4447,12 +4464,17 @@ must always be matched explicitly, even if
<B>dotglob</B>
is set.
When matching a pathname, the slash character must always be
matched explicitly.
In other cases, the
<B>``.''</B>
character is not treated specially.
When matching a pathname, 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
<FONT SIZE=-1><B>Pattern Matching</B>.
</FONT>
See the description of
<B>shopt</B>
@@ -13823,7 +13845,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash 4.4<TH ALIGN=CENTER width=33%>2018 March 2<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash 5.0<TH ALIGN=CENTER width=33%>2018 March 15<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -13929,6 +13951,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 02 March 2018 16:08:40 EST
Time: 15 March 2018 14:13:43 EDT
</BODY>
</HTML>
+172 -165
View File
@@ -2,10 +2,10 @@ This is bash.info, produced by makeinfo version 6.5 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 4.4, 2 March 2018).
Bash shell (version 5.0, 15 March 2018).
This is Edition 4.4, last updated 2 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 4.4.
This is Edition 5.0, last updated 15 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@@ -27,11 +27,11 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 4.4, 2 March 2018). The Bash home page is
Bash shell (version 5.0, 15 March 2018). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 4.4, last updated 2 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 4.4.
This is Edition 5.0, last updated 15 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -1859,22 +1859,23 @@ omitted, the operator tests only for existence.
'${PARAMETER#WORD}'
'${PARAMETER##WORD}'
The WORD is expanded to produce a pattern just as in filename
expansion (*note Filename Expansion::). If the pattern matches the
beginning of the expanded value of PARAMETER, then the result of
the expansion is the expanded value of PARAMETER with the shortest
matching pattern (the '#' case) or the longest matching pattern
(the '##' case) deleted. If PARAMETER is '@' or '*', the pattern
removal operation is applied to each positional parameter in turn,
and the expansion is the resultant list. If PARAMETER 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.
The WORD is expanded to produce a pattern and matched according to
the rules described below (*note Pattern Matching::). If the
pattern matches the beginning of the expanded value of PARAMETER,
then the result of the expansion is the expanded value of PARAMETER
with the shortest matching pattern (the '#' case) or the longest
matching pattern (the '##' case) deleted. If PARAMETER is '@' or
'*', the pattern removal operation is applied to each positional
parameter in turn, and the expansion is the resultant list. If
PARAMETER 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.
'${PARAMETER%WORD}'
'${PARAMETER%%WORD}'
The WORD is expanded to produce a pattern just as in filename
expansion. If the pattern matches a trailing portion of the
The WORD is expanded to produce a pattern and matched according to
the rules described below (*note Pattern Matching::). If the
pattern matches If the pattern matches a trailing portion of the
expanded value of PARAMETER, then the result of the expansion is
the value of PARAMETER with the shortest matching pattern (the '%'
case) or the longest matching pattern (the '%%' case) deleted. If
@@ -1888,21 +1889,23 @@ omitted, the operator tests only for existence.
The PATTERN is expanded to produce a pattern just as in filename
expansion. PARAMETER is expanded and the longest match of PATTERN
against its value is replaced with STRING. If PATTERN begins with
'/', all matches of PATTERN are replaced with STRING. Normally
only the first match is replaced. If PATTERN begins with '#', it
must match at the beginning of the expanded value of PARAMETER. If
PATTERN begins with '%', it must match at the end of the expanded
value of PARAMETER. If STRING is null, matches of PATTERN are
deleted and the '/' following PATTERN may be omitted. If the
'nocasematch' shell option (see the description of 'shopt' in *note
The Shopt Builtin::) is enabled, the match is performed without
regard to the case of alphabetic characters. If PARAMETER is '@'
or '*', the substitution operation is applied to each positional
parameter in turn, and the expansion is the resultant list. If
PARAMETER 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.
against its value is replaced with STRING. The match is performed
according to the rules described below (*note Pattern Matching::).
If PATTERN begins with '/', all matches of PATTERN are replaced
with STRING. Normally only the first match is replaced. If
PATTERN begins with '#', it must match at the beginning of the
expanded value of PARAMETER. If PATTERN begins with '%', it must
match at the end of the expanded value of PARAMETER. If STRING is
null, matches of PATTERN are deleted and the '/' following PATTERN
may be omitted. If the 'nocasematch' shell option (see the
description of 'shopt' in *note The Shopt Builtin::) is enabled,
the match is performed without regard to the case of alphabetic
characters. If PARAMETER is '@' or '*', the substitution operation
is applied to each positional parameter in turn, and the expansion
is the resultant list. If PARAMETER 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.
'${PARAMETER^PATTERN}'
'${PARAMETER^^PATTERN}'
@@ -2104,8 +2107,12 @@ performed without regard to the case of alphabetic characters.
the start of a filename or immediately following a slash must be matched
explicitly, unless the shell option 'dotglob' is set. The filenames '.'
and '..' must always be matched explicitly, even if 'dotglob' is set.
When matching a filename, the slash character must always be matched
explicitly. In other cases, the '.' character is not treated specially.
In other cases, the '.' character is not treated specially.
When matching a filename, 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 (*note
Pattern Matching::).
See the description of 'shopt' in *note The Shopt Builtin::, for a
description of the 'nocaseglob', 'nullglob', 'failglob', and 'dotglob'
@@ -11575,134 +11582,134 @@ D.5 Concept Index

Tag Table:
Node: Top889
Node: Introduction2801
Node: What is Bash?3017
Node: What is a shell?4131
Node: Definitions6669
Node: Basic Shell Features9620
Node: Shell Syntax10839
Node: Shell Operation11865
Node: Quoting13158
Node: Escape Character14458
Node: Single Quotes14943
Node: Double Quotes15291
Node: ANSI-C Quoting16569
Node: Locale Translation17828
Node: Comments18724
Node: Shell Commands19342
Node: Simple Commands20214
Node: Pipelines20845
Node: Lists23777
Node: Compound Commands25516
Node: Looping Constructs26528
Node: Conditional Constructs29023
Node: Command Grouping40078
Node: Coprocesses41557
Node: GNU Parallel43460
Node: Shell Functions47434
Node: Shell Parameters54517
Node: Positional Parameters58930
Node: Special Parameters59830
Node: Shell Expansions63167
Node: Brace Expansion65290
Node: Tilde Expansion68014
Node: Shell Parameter Expansion70362
Node: Command Substitution84650
Node: Arithmetic Expansion86005
Node: Process Substitution86937
Node: Word Splitting88057
Node: Filename Expansion90001
Node: Pattern Matching92375
Node: Quote Removal96361
Node: Redirections96656
Node: Executing Commands106214
Node: Simple Command Expansion106884
Node: Command Search and Execution108814
Node: Command Execution Environment111190
Node: Environment114174
Node: Exit Status115833
Node: Signals117503
Node: Shell Scripts119470
Node: Shell Builtin Commands121985
Node: Bourne Shell Builtins124023
Node: Bash Builtins144681
Node: Modifying Shell Behavior173589
Node: The Set Builtin173934
Node: The Shopt Builtin184347
Node: Special Builtins201217
Node: Shell Variables202196
Node: Bourne Shell Variables202633
Node: Bash Variables204737
Node: Bash Features234751
Node: Invoking Bash235650
Node: Bash Startup Files241636
Node: Interactive Shells246739
Node: What is an Interactive Shell?247149
Node: Is this Shell Interactive?247798
Node: Interactive Shell Behavior248613
Node: Bash Conditional Expressions252101
Node: Shell Arithmetic256467
Node: Aliases259284
Node: Arrays261832
Node: The Directory Stack267198
Node: Directory Stack Builtins267982
Node: Controlling the Prompt270950
Node: The Restricted Shell273712
Node: Bash POSIX Mode275537
Node: Job Control285888
Node: Job Control Basics286348
Node: Job Control Builtins291316
Node: Job Control Variables296043
Node: Command Line Editing297199
Node: Introduction and Notation298870
Node: Readline Interaction300493
Node: Readline Bare Essentials301684
Node: Readline Movement Commands303467
Node: Readline Killing Commands304427
Node: Readline Arguments306345
Node: Searching307389
Node: Readline Init File309575
Node: Readline Init File Syntax310722
Node: Conditional Init Constructs331093
Node: Sample Init File335289
Node: Bindable Readline Commands338406
Node: Commands For Moving339610
Node: Commands For History341459
Node: Commands For Text345754
Node: Commands For Killing349143
Node: Numeric Arguments351624
Node: Commands For Completion352763
Node: Keyboard Macros356954
Node: Miscellaneous Commands357641
Node: Readline vi Mode363594
Node: Programmable Completion364501
Node: Programmable Completion Builtins371962
Node: A Programmable Completion Example381848
Node: Using History Interactively387099
Node: Bash History Facilities387783
Node: Bash History Builtins390788
Node: History Interaction395319
Node: Event Designators398386
Node: Word Designators399605
Node: Modifiers401242
Node: Installing Bash402644
Node: Basic Installation403781
Node: Compilers and Options407039
Node: Compiling For Multiple Architectures407780
Node: Installation Names409473
Node: Specifying the System Type410291
Node: Sharing Defaults411007
Node: Operation Controls411680
Node: Optional Features412638
Node: Reporting Bugs423164
Node: Major Differences From The Bourne Shell424358
Node: GNU Free Documentation License441210
Node: Indexes466387
Node: Builtin Index466841
Node: Reserved Word Index473668
Node: Variable Index476116
Node: Function Index491794
Node: Concept Index505097
Node: Top891
Node: Introduction2805
Node: What is Bash?3021
Node: What is a shell?4135
Node: Definitions6673
Node: Basic Shell Features9624
Node: Shell Syntax10843
Node: Shell Operation11869
Node: Quoting13162
Node: Escape Character14462
Node: Single Quotes14947
Node: Double Quotes15295
Node: ANSI-C Quoting16573
Node: Locale Translation17832
Node: Comments18728
Node: Shell Commands19346
Node: Simple Commands20218
Node: Pipelines20849
Node: Lists23781
Node: Compound Commands25520
Node: Looping Constructs26532
Node: Conditional Constructs29027
Node: Command Grouping40082
Node: Coprocesses41561
Node: GNU Parallel43464
Node: Shell Functions47438
Node: Shell Parameters54521
Node: Positional Parameters58934
Node: Special Parameters59834
Node: Shell Expansions63171
Node: Brace Expansion65294
Node: Tilde Expansion68018
Node: Shell Parameter Expansion70366
Node: Command Substitution84849
Node: Arithmetic Expansion86204
Node: Process Substitution87136
Node: Word Splitting88256
Node: Filename Expansion90200
Node: Pattern Matching92730
Node: Quote Removal96716
Node: Redirections97011
Node: Executing Commands106569
Node: Simple Command Expansion107239
Node: Command Search and Execution109169
Node: Command Execution Environment111545
Node: Environment114529
Node: Exit Status116188
Node: Signals117858
Node: Shell Scripts119825
Node: Shell Builtin Commands122340
Node: Bourne Shell Builtins124378
Node: Bash Builtins145036
Node: Modifying Shell Behavior173944
Node: The Set Builtin174289
Node: The Shopt Builtin184702
Node: Special Builtins201572
Node: Shell Variables202551
Node: Bourne Shell Variables202988
Node: Bash Variables205092
Node: Bash Features235106
Node: Invoking Bash236005
Node: Bash Startup Files241991
Node: Interactive Shells247094
Node: What is an Interactive Shell?247504
Node: Is this Shell Interactive?248153
Node: Interactive Shell Behavior248968
Node: Bash Conditional Expressions252456
Node: Shell Arithmetic256822
Node: Aliases259639
Node: Arrays262187
Node: The Directory Stack267553
Node: Directory Stack Builtins268337
Node: Controlling the Prompt271305
Node: The Restricted Shell274067
Node: Bash POSIX Mode275892
Node: Job Control286243
Node: Job Control Basics286703
Node: Job Control Builtins291671
Node: Job Control Variables296398
Node: Command Line Editing297554
Node: Introduction and Notation299225
Node: Readline Interaction300848
Node: Readline Bare Essentials302039
Node: Readline Movement Commands303822
Node: Readline Killing Commands304782
Node: Readline Arguments306700
Node: Searching307744
Node: Readline Init File309930
Node: Readline Init File Syntax311077
Node: Conditional Init Constructs331448
Node: Sample Init File335644
Node: Bindable Readline Commands338761
Node: Commands For Moving339965
Node: Commands For History341814
Node: Commands For Text346109
Node: Commands For Killing349498
Node: Numeric Arguments351979
Node: Commands For Completion353118
Node: Keyboard Macros357309
Node: Miscellaneous Commands357996
Node: Readline vi Mode363949
Node: Programmable Completion364856
Node: Programmable Completion Builtins372317
Node: A Programmable Completion Example382203
Node: Using History Interactively387454
Node: Bash History Facilities388138
Node: Bash History Builtins391143
Node: History Interaction395674
Node: Event Designators398741
Node: Word Designators399960
Node: Modifiers401597
Node: Installing Bash402999
Node: Basic Installation404136
Node: Compilers and Options407394
Node: Compiling For Multiple Architectures408135
Node: Installation Names409828
Node: Specifying the System Type410646
Node: Sharing Defaults411362
Node: Operation Controls412035
Node: Optional Features412993
Node: Reporting Bugs423519
Node: Major Differences From The Bourne Shell424713
Node: GNU Free Documentation License441565
Node: Indexes466742
Node: Builtin Index467196
Node: Reserved Word Index474023
Node: Variable Index476471
Node: Function Index492149
Node: Concept Index505452

End Tag Table
BIN
View File
Binary file not shown.
+5147 -5132
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+18 -12
View File
@@ -1,11 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This text is a brief description of the features that are present in
the Bash shell (version 4.4, 2 March 2018).
the Bash shell (version 5.0, 15 March 2018).
This is Edition 4.4, last updated 2 March 2018,
This is Edition 5.0, last updated 15 March 2018,
of The GNU Bash Reference Manual,
for Bash, Version 4.4.
for Bash, Version 5.0.
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@@ -284,12 +284,12 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
<h1 class="top">Bash Features</h1>
<p>This text is a brief description of the features that are present in
the Bash shell (version 4.4, 2 March 2018).
the Bash shell (version 5.0, 15 March 2018).
The Bash home page is <a href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
</p>
<p>This is Edition 4.4, last updated 2 March 2018,
<p>This is Edition 5.0, last updated 15 March 2018,
of <cite>The GNU Bash Reference Manual</cite>,
for <code>Bash</code>, Version 4.4.
for <code>Bash</code>, Version 5.0.
</p>
<p>Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -2716,8 +2716,8 @@ array, and an index of -1 references the last element.
<dt><code>${<var>parameter</var>#<var>word</var>}</code></dt>
<dt><code>${<var>parameter</var>##<var>word</var>}</code></dt>
<dd><p>The <var>word</var>
is expanded to produce a pattern just as in filename
expansion (see <a href="#Filename-Expansion">Filename Expansion</a>). If the pattern matches
is expanded to produce a pattern and matched according to the rules
described below (see <a href="#Pattern-Matching">Pattern Matching</a>). If the pattern matches
the beginning of the expanded value of <var>parameter</var>,
then the result of the expansion is the expanded value of <var>parameter</var>
with the shortest matching pattern (the &lsquo;<samp>#</samp>&rsquo; case) or the
@@ -2733,8 +2733,9 @@ array in turn, and the expansion is the resultant list.
</dd>
<dt><code>${<var>parameter</var>%<var>word</var>}</code></dt>
<dt><code>${<var>parameter</var>%%<var>word</var>}</code></dt>
<dd><p>The <var>word</var> is expanded to produce a pattern just as in
filename expansion.
<dd><p>The <var>word</var>
is expanded to produce a pattern and matched according to the rules
described below (see <a href="#Pattern-Matching">Pattern Matching</a>). If the pattern matches
If the pattern matches a trailing portion of the expanded value of
<var>parameter</var>, then the result of the expansion is the value of
<var>parameter</var> with the shortest matching pattern (the &lsquo;<samp>%</samp>&rsquo; case)
@@ -2754,6 +2755,8 @@ array in turn, and the expansion is the resultant list.
filename expansion.
<var>Parameter</var> is expanded and the longest match of <var>pattern</var>
against its value is replaced with <var>string</var>.
The match is performed according to the rules described below
(see <a href="#Pattern-Matching">Pattern Matching</a>).
If <var>pattern</var> begins with &lsquo;<samp>/</samp>&rsquo;, all matches of <var>pattern</var> are
replaced with <var>string</var>. Normally only the first match is replaced.
If <var>pattern</var> begins with &lsquo;<samp>#</samp>&rsquo;, it must match at the beginning
@@ -3045,10 +3048,13 @@ at the start of a filename or immediately following a slash
must be matched explicitly, unless the shell option <code>dotglob</code> is set.
The filenames &lsquo;<samp>.</samp>&rsquo; and &lsquo;<samp>..</samp>&rsquo; must always be matched explicitly,
even if <code>dotglob</code> is set.
When matching a filename, the slash character must always be
matched explicitly.
In other cases, the &lsquo;<samp>.</samp>&rsquo; character is not treated specially.
</p>
<p>When matching a filename, 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 (see <a href="#Pattern-Matching">Pattern Matching</a>).
</p>
<p>See the description of <code>shopt</code> in <a href="#The-Shopt-Builtin">The Shopt Builtin</a>,
for a description of the <code>nocaseglob</code>, <code>nullglob</code>,
<code>failglob</code>, and <code>dotglob</code> options.
+172 -165
View File
@@ -2,10 +2,10 @@ This is bashref.info, produced by makeinfo version 6.5 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 4.4, 2 March 2018).
Bash shell (version 5.0, 15 March 2018).
This is Edition 4.4, last updated 2 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 4.4.
This is Edition 5.0, last updated 15 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@@ -27,11 +27,11 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 4.4, 2 March 2018). The Bash home page is
Bash shell (version 5.0, 15 March 2018). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 4.4, last updated 2 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 4.4.
This is Edition 5.0, last updated 15 March 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -1859,22 +1859,23 @@ omitted, the operator tests only for existence.
'${PARAMETER#WORD}'
'${PARAMETER##WORD}'
The WORD is expanded to produce a pattern just as in filename
expansion (*note Filename Expansion::). If the pattern matches the
beginning of the expanded value of PARAMETER, then the result of
the expansion is the expanded value of PARAMETER with the shortest
matching pattern (the '#' case) or the longest matching pattern
(the '##' case) deleted. If PARAMETER is '@' or '*', the pattern
removal operation is applied to each positional parameter in turn,
and the expansion is the resultant list. If PARAMETER 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.
The WORD is expanded to produce a pattern and matched according to
the rules described below (*note Pattern Matching::). If the
pattern matches the beginning of the expanded value of PARAMETER,
then the result of the expansion is the expanded value of PARAMETER
with the shortest matching pattern (the '#' case) or the longest
matching pattern (the '##' case) deleted. If PARAMETER is '@' or
'*', the pattern removal operation is applied to each positional
parameter in turn, and the expansion is the resultant list. If
PARAMETER 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.
'${PARAMETER%WORD}'
'${PARAMETER%%WORD}'
The WORD is expanded to produce a pattern just as in filename
expansion. If the pattern matches a trailing portion of the
The WORD is expanded to produce a pattern and matched according to
the rules described below (*note Pattern Matching::). If the
pattern matches If the pattern matches a trailing portion of the
expanded value of PARAMETER, then the result of the expansion is
the value of PARAMETER with the shortest matching pattern (the '%'
case) or the longest matching pattern (the '%%' case) deleted. If
@@ -1888,21 +1889,23 @@ omitted, the operator tests only for existence.
The PATTERN is expanded to produce a pattern just as in filename
expansion. PARAMETER is expanded and the longest match of PATTERN
against its value is replaced with STRING. If PATTERN begins with
'/', all matches of PATTERN are replaced with STRING. Normally
only the first match is replaced. If PATTERN begins with '#', it
must match at the beginning of the expanded value of PARAMETER. If
PATTERN begins with '%', it must match at the end of the expanded
value of PARAMETER. If STRING is null, matches of PATTERN are
deleted and the '/' following PATTERN may be omitted. If the
'nocasematch' shell option (see the description of 'shopt' in *note
The Shopt Builtin::) is enabled, the match is performed without
regard to the case of alphabetic characters. If PARAMETER is '@'
or '*', the substitution operation is applied to each positional
parameter in turn, and the expansion is the resultant list. If
PARAMETER 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.
against its value is replaced with STRING. The match is performed
according to the rules described below (*note Pattern Matching::).
If PATTERN begins with '/', all matches of PATTERN are replaced
with STRING. Normally only the first match is replaced. If
PATTERN begins with '#', it must match at the beginning of the
expanded value of PARAMETER. If PATTERN begins with '%', it must
match at the end of the expanded value of PARAMETER. If STRING is
null, matches of PATTERN are deleted and the '/' following PATTERN
may be omitted. If the 'nocasematch' shell option (see the
description of 'shopt' in *note The Shopt Builtin::) is enabled,
the match is performed without regard to the case of alphabetic
characters. If PARAMETER is '@' or '*', the substitution operation
is applied to each positional parameter in turn, and the expansion
is the resultant list. If PARAMETER 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.
'${PARAMETER^PATTERN}'
'${PARAMETER^^PATTERN}'
@@ -2104,8 +2107,12 @@ performed without regard to the case of alphabetic characters.
the start of a filename or immediately following a slash must be matched
explicitly, unless the shell option 'dotglob' is set. The filenames '.'
and '..' must always be matched explicitly, even if 'dotglob' is set.
When matching a filename, the slash character must always be matched
explicitly. In other cases, the '.' character is not treated specially.
In other cases, the '.' character is not treated specially.
When matching a filename, 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 (*note
Pattern Matching::).
See the description of 'shopt' in *note The Shopt Builtin::, for a
description of the 'nocaseglob', 'nullglob', 'failglob', and 'dotglob'
@@ -11575,134 +11582,134 @@ D.5 Concept Index

Tag Table:
Node: Top889
Node: Introduction2801
Node: What is Bash?3017
Node: What is a shell?4131
Node: Definitions6669
Node: Basic Shell Features9620
Node: Shell Syntax10839
Node: Shell Operation11865
Node: Quoting13158
Node: Escape Character14458
Node: Single Quotes14943
Node: Double Quotes15291
Node: ANSI-C Quoting16569
Node: Locale Translation17828
Node: Comments18724
Node: Shell Commands19342
Node: Simple Commands20214
Node: Pipelines20845
Node: Lists23777
Node: Compound Commands25516
Node: Looping Constructs26528
Node: Conditional Constructs29023
Node: Command Grouping40078
Node: Coprocesses41557
Node: GNU Parallel43460
Node: Shell Functions47434
Node: Shell Parameters54517
Node: Positional Parameters58930
Node: Special Parameters59830
Node: Shell Expansions63167
Node: Brace Expansion65290
Node: Tilde Expansion68014
Node: Shell Parameter Expansion70362
Node: Command Substitution84650
Node: Arithmetic Expansion86005
Node: Process Substitution86937
Node: Word Splitting88057
Node: Filename Expansion90001
Node: Pattern Matching92375
Node: Quote Removal96361
Node: Redirections96656
Node: Executing Commands106214
Node: Simple Command Expansion106884
Node: Command Search and Execution108814
Node: Command Execution Environment111190
Node: Environment114174
Node: Exit Status115833
Node: Signals117503
Node: Shell Scripts119470
Node: Shell Builtin Commands121985
Node: Bourne Shell Builtins124023
Node: Bash Builtins144681
Node: Modifying Shell Behavior173589
Node: The Set Builtin173934
Node: The Shopt Builtin184347
Node: Special Builtins201217
Node: Shell Variables202196
Node: Bourne Shell Variables202633
Node: Bash Variables204737
Node: Bash Features234751
Node: Invoking Bash235650
Node: Bash Startup Files241636
Node: Interactive Shells246739
Node: What is an Interactive Shell?247149
Node: Is this Shell Interactive?247798
Node: Interactive Shell Behavior248613
Node: Bash Conditional Expressions252101
Node: Shell Arithmetic256467
Node: Aliases259284
Node: Arrays261832
Node: The Directory Stack267198
Node: Directory Stack Builtins267982
Node: Controlling the Prompt270950
Node: The Restricted Shell273712
Node: Bash POSIX Mode275537
Node: Job Control285888
Node: Job Control Basics286348
Node: Job Control Builtins291316
Node: Job Control Variables296043
Node: Command Line Editing297199
Node: Introduction and Notation298870
Node: Readline Interaction300493
Node: Readline Bare Essentials301684
Node: Readline Movement Commands303467
Node: Readline Killing Commands304427
Node: Readline Arguments306345
Node: Searching307389
Node: Readline Init File309575
Node: Readline Init File Syntax310722
Node: Conditional Init Constructs331093
Node: Sample Init File335289
Node: Bindable Readline Commands338406
Node: Commands For Moving339610
Node: Commands For History341459
Node: Commands For Text345754
Node: Commands For Killing349143
Node: Numeric Arguments351624
Node: Commands For Completion352763
Node: Keyboard Macros356954
Node: Miscellaneous Commands357641
Node: Readline vi Mode363594
Node: Programmable Completion364501
Node: Programmable Completion Builtins371962
Node: A Programmable Completion Example381848
Node: Using History Interactively387099
Node: Bash History Facilities387783
Node: Bash History Builtins390788
Node: History Interaction395319
Node: Event Designators398386
Node: Word Designators399605
Node: Modifiers401242
Node: Installing Bash402644
Node: Basic Installation403781
Node: Compilers and Options407039
Node: Compiling For Multiple Architectures407780
Node: Installation Names409473
Node: Specifying the System Type410291
Node: Sharing Defaults411007
Node: Operation Controls411680
Node: Optional Features412638
Node: Reporting Bugs423164
Node: Major Differences From The Bourne Shell424358
Node: GNU Free Documentation License441210
Node: Indexes466387
Node: Builtin Index466841
Node: Reserved Word Index473668
Node: Variable Index476116
Node: Function Index491794
Node: Concept Index505097
Node: Top891
Node: Introduction2805
Node: What is Bash?3021
Node: What is a shell?4135
Node: Definitions6673
Node: Basic Shell Features9624
Node: Shell Syntax10843
Node: Shell Operation11869
Node: Quoting13162
Node: Escape Character14462
Node: Single Quotes14947
Node: Double Quotes15295
Node: ANSI-C Quoting16573
Node: Locale Translation17832
Node: Comments18728
Node: Shell Commands19346
Node: Simple Commands20218
Node: Pipelines20849
Node: Lists23781
Node: Compound Commands25520
Node: Looping Constructs26532
Node: Conditional Constructs29027
Node: Command Grouping40082
Node: Coprocesses41561
Node: GNU Parallel43464
Node: Shell Functions47438
Node: Shell Parameters54521
Node: Positional Parameters58934
Node: Special Parameters59834
Node: Shell Expansions63171
Node: Brace Expansion65294
Node: Tilde Expansion68018
Node: Shell Parameter Expansion70366
Node: Command Substitution84849
Node: Arithmetic Expansion86204
Node: Process Substitution87136
Node: Word Splitting88256
Node: Filename Expansion90200
Node: Pattern Matching92730
Node: Quote Removal96716
Node: Redirections97011
Node: Executing Commands106569
Node: Simple Command Expansion107239
Node: Command Search and Execution109169
Node: Command Execution Environment111545
Node: Environment114529
Node: Exit Status116188
Node: Signals117858
Node: Shell Scripts119825
Node: Shell Builtin Commands122340
Node: Bourne Shell Builtins124378
Node: Bash Builtins145036
Node: Modifying Shell Behavior173944
Node: The Set Builtin174289
Node: The Shopt Builtin184702
Node: Special Builtins201572
Node: Shell Variables202551
Node: Bourne Shell Variables202988
Node: Bash Variables205092
Node: Bash Features235106
Node: Invoking Bash236005
Node: Bash Startup Files241991
Node: Interactive Shells247094
Node: What is an Interactive Shell?247504
Node: Is this Shell Interactive?248153
Node: Interactive Shell Behavior248968
Node: Bash Conditional Expressions252456
Node: Shell Arithmetic256822
Node: Aliases259639
Node: Arrays262187
Node: The Directory Stack267553
Node: Directory Stack Builtins268337
Node: Controlling the Prompt271305
Node: The Restricted Shell274067
Node: Bash POSIX Mode275892
Node: Job Control286243
Node: Job Control Basics286703
Node: Job Control Builtins291671
Node: Job Control Variables296398
Node: Command Line Editing297554
Node: Introduction and Notation299225
Node: Readline Interaction300848
Node: Readline Bare Essentials302039
Node: Readline Movement Commands303822
Node: Readline Killing Commands304782
Node: Readline Arguments306700
Node: Searching307744
Node: Readline Init File309930
Node: Readline Init File Syntax311077
Node: Conditional Init Constructs331448
Node: Sample Init File335644
Node: Bindable Readline Commands338761
Node: Commands For Moving339965
Node: Commands For History341814
Node: Commands For Text346109
Node: Commands For Killing349498
Node: Numeric Arguments351979
Node: Commands For Completion353118
Node: Keyboard Macros357309
Node: Miscellaneous Commands357996
Node: Readline vi Mode363949
Node: Programmable Completion364856
Node: Programmable Completion Builtins372317
Node: A Programmable Completion Example382203
Node: Using History Interactively387454
Node: Bash History Facilities388138
Node: Bash History Builtins391143
Node: History Interaction395674
Node: Event Designators398741
Node: Word Designators399960
Node: Modifiers401597
Node: Installing Bash402999
Node: Basic Installation404136
Node: Compilers and Options407394
Node: Compiling For Multiple Architectures408135
Node: Installation Names409828
Node: Specifying the System Type410646
Node: Sharing Defaults411362
Node: Operation Controls412035
Node: Optional Features412993
Node: Reporting Bugs423519
Node: Major Differences From The Bourne Shell424713
Node: GNU Free Documentation License441565
Node: Indexes466742
Node: Builtin Index467196
Node: Reserved Word Index474023
Node: Variable Index476471
Node: Function Index492149
Node: Concept Index505452

End Tag Table
+10 -10
View File
@@ -1,4 +1,4 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/MacPorts 2017_2) (preloaded format=pdfetex 2017.7.5) 2 MAR 2018 16:08
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/MacPorts 2017_2) (preloaded format=pdfetex 2017.7.5) 15 MAR 2018 14:13
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
@@ -243,7 +243,7 @@ arallel -k traceroute[]
[43] [44]
[45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55]
Overfull \hbox (26.76846pt too wide) in paragraph at lines 4350--4350
Overfull \hbox (26.76846pt too wide) in paragraph at lines 4356--4356
[]@texttt mapfile [-d @textttsl de-lim@texttt ] [-n @textttsl count@texttt ] [
-O @textttsl ori-gin@texttt ] [-s @textttsl count@texttt ] [-t] [-u @textttsl f
d@texttt ][]
@@ -257,7 +257,7 @@ d@texttt ][]
.etc.
[56] [57]
Overfull \hbox (38.26584pt too wide) in paragraph at lines 4558--4558
Overfull \hbox (38.26584pt too wide) in paragraph at lines 4564--4564
[]@texttt readarray [-d @textttsl de-lim@texttt ] [-n @textttsl count@texttt ]
[-O @textttsl ori-gin@texttt ] [-s @textttsl count@texttt ] [-t] [-u @textttsl
fd@texttt ][]
@@ -272,7 +272,7 @@ Overfull \hbox (38.26584pt too wide) in paragraph at lines 4558--4558
[58] [59] [60] [61] [62] [63] [64] [65] [66] [67] [68] [69] [70] Chapter 5
[71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] Chapter 6 [83]
Overfull \hbox (49.43388pt too wide) in paragraph at lines 6327--6327
Overfull \hbox (49.43388pt too wide) in paragraph at lines 6333--6333
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -285,7 +285,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
Overfull \hbox (72.42863pt too wide) in paragraph at lines 6328--6328
Overfull \hbox (72.42863pt too wide) in paragraph at lines 6334--6334
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
-
@@ -299,7 +299,7 @@ Overfull \hbox (72.42863pt too wide) in paragraph at lines 6328--6328
.etc.
Overfull \hbox (32.18782pt too wide) in paragraph at lines 6329--6329
Overfull \hbox (32.18782pt too wide) in paragraph at lines 6335--6335
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -389,7 +389,7 @@ texinfo.tex: doing @include of fdl.texi
Here is how much of TeX's memory you used:
4064 strings out of 497104
47069 string characters out of 6206767
136546 words of memory out of 5000000
136596 words of memory out of 5000000
4846 multiletter control sequences out of 15000+600000
34315 words of font info for 116 fonts, out of 8000000 for 9000
51 hyphenation exceptions out of 8191
@@ -411,10 +411,10 @@ e/fonts/type1/public/amsfonts/cm/cmtt12.pfb></opt/local/share/texmf-texlive/fon
ts/type1/public/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fonts/typ
e1/public/cm-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fonts/type1/pub
lic/cm-super/sfrm1440.pfb>
Output written on bashref.pdf (182 pages, 747172 bytes).
Output written on bashref.pdf (182 pages, 747794 bytes).
PDF statistics:
2611 PDF objects out of 2984 (max. 8388607)
2384 compressed objects within 24 object streams
2615 PDF objects out of 2984 (max. 8388607)
2388 compressed objects within 24 object streams
308 named destinations out of 1000 (max. 500000)
1125 words of extra memory for PDF output out of 10000 (max. 10000000)
BIN
View File
Binary file not shown.
+686 -679
View File
File diff suppressed because it is too large Load Diff
+12 -6
View File
@@ -2189,8 +2189,8 @@ array, and an index of -1 references the last element.
@item $@{@var{parameter}#@var{word}@}
@itemx $@{@var{parameter}##@var{word}@}
The @var{word}
is expanded to produce a pattern just as in filename
expansion (@pxref{Filename Expansion}). If the pattern matches
is expanded to produce a pattern and matched according to the rules
described below (@pxref{Pattern Matching}). If the pattern matches
the beginning of the expanded value of @var{parameter},
then the result of the expansion is the expanded value of @var{parameter}
with the shortest matching pattern (the @samp{#} case) or the
@@ -2205,8 +2205,9 @@ array in turn, and the expansion is the resultant list.
@item $@{@var{parameter}%@var{word}@}
@itemx $@{@var{parameter}%%@var{word}@}
The @var{word} is expanded to produce a pattern just as in
filename expansion.
The @var{word}
is expanded to produce a pattern and matched according to the rules
described below (@pxref{Pattern Matching}). If the pattern matches
If the pattern matches a trailing portion of the expanded value of
@var{parameter}, then the result of the expansion is the value of
@var{parameter} with the shortest matching pattern (the @samp{%} case)
@@ -2225,6 +2226,8 @@ 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}.
The match is performed according to the rules described below
(@pxref{Pattern Matching}).
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
@@ -2481,10 +2484,13 @@ at the start of a filename or immediately following a slash
must be matched explicitly, unless the shell option @code{dotglob} is set.
The filenames @samp{.} and @samp{..} must always be matched explicitly,
even if @code{dotglob} is set.
When matching a filename, the slash character must always be
matched explicitly.
In other cases, the @samp{.} character is not treated specially.
When matching a filename, 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 (@pxref{Pattern Matching}).
See the description of @code{shopt} in @ref{The Shopt Builtin},
for a description of the @code{nocaseglob}, @code{nullglob},
@code{failglob}, and @code{dotglob} options.
+1 -1
View File
@@ -42,7 +42,7 @@
@numsubsecentry{Redirecting Output}{3.6.2}{}{35}
@numsubsecentry{Appending Redirected Output}{3.6.3}{}{35}
@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{35}
@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{35}
@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{36}
@numsubsecentry{Here Documents}{3.6.6}{}{36}
@numsubsecentry{Here Strings}{3.6.7}{}{36}
@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{36}
+1 -1
View File
@@ -1820,4 +1820,4 @@ SSEEEE AALLSSOO
GNU Bash-4.2 2004 Apr 20 BASH_BUILTINS(1)
GNU Bash 5.0 2004 Apr 20 BASH_BUILTINS(1)
+1 -1
View File
@@ -7,7 +7,7 @@
.de FN
\fI\|\\$1\|\fP
..
.TH BASH_BUILTINS 1 "2004 Apr 20" "GNU Bash-4.2"
.TH BASH_BUILTINS 1 "2004 Apr 20" "GNU Bash 5.0"
.SH NAME
bash, :, ., [, alias, bg, bind, break, builtin, caller,
cd, command, compgen, complete,
+37 -37
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Fri Mar 2 16:08:28 2018
%%CreationDate: Thu Mar 15 14:13:33 2018
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -376,8 +376,8 @@ F0 -.25(va)2.976 G 2.976(riable. Each).25 F .476(non-option ar)2.976 F
(ut each binding or command must be passed as a separate ar)-3.183 F
.484(gument; e.g., '"\\C\255x\\C\255r":)-.18 F 2.5
(re\255read\255init\255\214le'. Options,)144 726 R(if supplied, ha)2.5 E
.3 -.15(ve t)-.2 H(he follo).15 E(wing meanings:)-.25 E(GNU Bash-4.2)72
768 Q(2004 Apr 20)148.735 E(1)203.725 E 0 Cg EP
.3 -.15(ve t)-.2 H(he follo).15 E(wing meanings:)-.25 E(GNU Bash 5.0)72
768 Q(2004 Apr 20)149.565 E(1)203.725 E 0 Cg EP
%%Page: 2 2
%%BeginPageSetup
BP
@@ -500,7 +500,7 @@ G(H).855 E F0(de\214nes)3.286 E .85
5.664(.A)C(lternati)-5.664 E .964 -.15(ve d)-.25 H .665
(irectory names in).15 F F3(CDP)3.165 E -.855(AT)-.666 G(H).855 E F0
.665(are separated by a colon \(:\).)2.915 F 3.165(An)5.665 G .665
(ull directory name)-3.165 F(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E
(ull directory name)-3.165 F(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E
(2)203.725 E 0 Cg EP
%%Page: 3 3
%%BeginPageSetup
@@ -639,8 +639,8 @@ F2<ad44>3.847 E F0 1.347(option indicates that the remaining options)
F2<ad53>3.222 E F0 .723
(options\) should be quoted to protect them from e)3.222 F(xpan-)-.15 E
(sion before the)144 722.4 Q F2(complete)2.5 E F0 -.2(bu)2.5 G
(iltin is in).2 E -.2(vo)-.4 G -.1(ke).2 G(d.).1 E(GNU Bash-4.2)72 768 Q
(2004 Apr 20)148.735 E(3)203.725 E 0 Cg EP
(iltin is in).2 E -.2(vo)-.4 G -.1(ke).2 G(d.).1 E(GNU Bash 5.0)72 768 Q
(2004 Apr 20)149.565 E(3)203.725 E 0 Cg EP
%%Page: 4 4
%%BeginPageSetup
BP
@@ -712,8 +712,8 @@ Q(May also be speci\214ed as)5 E F1<ad73>2.5 E F0(.)A F1(setopt)184 696
Q F0 -1.11(Va)224 696 S(lid ar)1.11 E(guments for the)-.18 E F1<ad6f>2.5
E F0(option to the)2.5 E F1(set)2.5 E F0 -.2(bu)2.5 G(iltin.).2 E F1
(shopt)184 708 Q F0(Shell option names as accepted by the)224 708 Q F1
(shopt)2.5 E F0 -.2(bu)2.5 G(iltin.).2 E(GNU Bash-4.2)72 768 Q
(2004 Apr 20)148.735 E(4)203.725 E 0 Cg EP
(shopt)2.5 E F0 -.2(bu)2.5 G(iltin.).2 E(GNU Bash 5.0)72 768 Q
(2004 Apr 20)149.565 E(4)203.725 E 0 Cg EP
%%Page: 5 5
%%BeginPageSetup
BP
@@ -832,8 +832,8 @@ G 3.765(nt).15 G 1.265(hen display the v)-3.765 F 1.265(alues of)-.25 F
-.25(va)144 727.2 S 3.483(riables. The).25 F F1<ad70>3.483 E F0 .983
(option will display the attrib)3.483 F .983(utes and v)-.2 F .982
(alues of each)-.25 F F2(name)3.482 E F0 5.982(.W).18 G(hen)-5.982 E F1
<ad70>3.482 E F0 .982(is used)3.482 F(GNU Bash-4.2)72 768 Q(2004 Apr 20)
148.735 E(5)203.725 E 0 Cg EP
<ad70>3.482 E F0 .982(is used)3.482 F(GNU Bash 5.0)72 768 Q(2004 Apr 20)
149.565 E(5)203.725 E 0 Cg EP
%%Page: 6 6
%%BeginPageSetup
BP
@@ -966,8 +966,8 @@ F2<ad6c>144 669.6 Q F0 .882
(Print the directory stack with one entry per line.)180 693.6 Q F2<ad76>
144 705.6 Q F0 .272(Print the directory stack with one entry per line, \
pre\214xing each entry with its inde)180 705.6 R 2.773(xi)-.15 G 2.773
(nt)-2.773 G(he)-2.773 E(stack.)180 717.6 Q(GNU Bash-4.2)72 768 Q
(2004 Apr 20)148.735 E(6)203.725 E 0 Cg EP
(nt)-2.773 G(he)-2.773 E(stack.)180 717.6 Q(GNU Bash 5.0)72 768 Q
(2004 Apr 20)149.565 E(6)203.725 E 0 Cg EP
%%Page: 7 7
%%BeginPageSetup
BP
@@ -1087,8 +1087,8 @@ F .399(guments, the)-.18 F .099(list consists of all enabled shell b)144
2.879 E F0 -.2(bu)2.878 G 2.878(iltins. The).2 F .378(return v)2.878 F
(alue)-.25 E .994(is 0 unless a)144 727.2 R F2(name)3.854 E F0 .994
(is not a shell b)3.674 F .994(uiltin or there is an error loading a ne)
-.2 F 3.495(wb)-.25 G .995(uiltin from a shared)-3.695 F(GNU Bash-4.2)72
768 Q(2004 Apr 20)148.735 E(7)203.725 E 0 Cg EP
-.2 F 3.495(wb)-.25 G .995(uiltin from a shared)-3.695 F(GNU Bash 5.0)72
768 Q(2004 Apr 20)149.565 E(7)203.725 E 0 Cg EP
%%Page: 8 8
%%BeginPageSetup
BP
@@ -1228,7 +1228,7 @@ E F2(last)2.732 E F0 .454(specify history lines out of range.)144 684 R
708 R -.15(xe)-.15 G 1.136(cuted, unless).15 F F2(cmd)3.836 E F0 1.136
(does not)4.406 F(specify a v)144 720 Q
(alid history line, in which case)-.25 E F1(fc)2.5 E F0(returns f)2.5 E
(ailure.)-.1 E(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(8)203.725 E 0
(ailure.)-.1 E(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(8)203.725 E 0
Cg EP
%%Page: 9 9
%%BeginPageSetup
@@ -1354,7 +1354,7 @@ G 3.367(sd).15 G(etailed)-3.367 E .307(help on all commands matching)144
710.4 R F2(pattern)2.807 E F0 2.807(;o).24 G .307
(therwise help for all the b)-2.807 F .306
(uiltins and shell control struc-)-.2 F(tures is printed.)144 722.4 Q
(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(9)203.725 E 0 Cg EP
(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(9)203.725 E 0 Cg EP
%%Page: 10 10
%%BeginPageSetup
BP
@@ -1464,8 +1464,8 @@ E F0(... ])2.5 E(The \214rst form lists the acti)144 655.2 Q .3 -.15
F .194(as last noti-)-.1 F(\214ed of their status.)180 691.2 Q F1<ad70>
144 703.2 Q F0(List only the process ID of the job')180 703.2 Q 2.5(sp)
-.55 G(rocess group leader)-2.5 E(.)-.55 E F1<ad72>144 715.2 Q F0
(Display only running jobs.)180 715.2 Q(GNU Bash-4.2)72 768 Q
(2004 Apr 20)148.735 E(10)198.725 E 0 Cg EP
(Display only running jobs.)180 715.2 Q(GNU Bash 5.0)72 768 Q
(2004 Apr 20)149.565 E(10)198.725 E 0 Cg EP
%%Page: 11 11
%%BeginPageSetup
BP
@@ -1606,7 +1606,7 @@ F0 .275(is e)2.775 F -.25(va)-.25 G .274
4.406 E(ay)-.15 E F0(is)4.406 E(in)144 708 Q -.25(va)-.4 G
(lid or unassignable, or if).25 E F2(arr)2.5 E(ay)-.15 E F0
(is not an inde)2.5 E -.15(xe)-.15 G 2.5(da).15 G(rray)-2.5 E(.)-.65 E
(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(11)198.725 E 0 Cg EP
(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(11)198.725 E 0 Cg EP
%%Page: 12 12
%%BeginPageSetup
BP
@@ -1720,7 +1720,7 @@ F2(n)A F0 1.268(Rotates the stack so that the)180 684 R F2(n)3.768 E F0
(Rotates the stack so that the)180 708 R F2(n)3.42 E F0 .92
(th directory \(counting from the right of the list sho)B .92(wn by)-.25
F F1(dirs)180 720 Q F0 2.5(,s)C(tarting with zero\) is at the top.)-2.5
E(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(12)198.725 E 0 Cg EP
E(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(12)198.725 E 0 Cg EP
%%Page: 13 13
%%BeginPageSetup
BP
@@ -1852,7 +1852,7 @@ G(ad).18 E F0 .428(to time out and return f)2.929 F .428
(ailure if a complete line of input \(or a speci\214ed num-)-.1 F .56
(ber of characters\) is not read within)180 722.4 R F1(timeout)3.061 E
F0(seconds.)3.061 E F1(timeout)5.561 E F0 .561(may be a decimal number)
3.061 F(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(13)198.725 E 0 Cg EP
3.061 F(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(13)198.725 E 0 Cg EP
%%Page: 14 14
%%BeginPageSetup
BP
@@ -2001,7 +2001,7 @@ F2 1.521(compound command)4.021 F F0(\(see)4.021 E F3 1.521
F1(&&)3.418 E F0(or)3.418 E F1(||)3.418 E F0 3.418(,a)C 1.218 -.15(ny c)
-3.418 H .918(ommand in a pipeline b).15 F .917
(ut the last, or if the command')-.2 F 3.417(sr)-.55 G(eturn)-3.417 E
(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(14)198.725 E 0 Cg EP
(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(14)198.725 E 0 Cg EP
%%Page: 15 15
%%BeginPageSetup
BP
@@ -2088,8 +2088,8 @@ E F0(.)A F1(noclob)184 654 Q(ber)-.1 E F0(Same as)224 666 Q F1<ad43>2.5
E F0(.)A F1(noexec)184 678 Q F0(Same as)224 678 Q F1<ad6e>2.5 E F0(.)A
F1(noglob)184 690 Q F0(Same as)224 690 Q F1<ad66>2.5 E F0(.)A F1(nolog)
184 702 Q F0(Currently ignored.)224 702 Q F1(notify)184 714 Q F0
(Same as)224 714 Q F1<ad62>2.5 E F0(.)A(GNU Bash-4.2)72 768 Q
(2004 Apr 20)148.735 E(15)198.725 E 0 Cg EP
(Same as)224 714 Q F1<ad62>2.5 E F0(.)A(GNU Bash 5.0)72 768 Q
(2004 Apr 20)149.565 E(15)198.725 E 0 Cg EP
%%Page: 16 16
%%BeginPageSetup
BP
@@ -2201,8 +2201,8 @@ E(ault,)-.1 E F1(bash)2.686 E F0(follo)2.686 E .186
(substitutions, and commands e)184 702 R -.15(xe)-.15 G 1.932
(cuted in a subshell en).15 F 4.432(vironment. The)-.4 F F1(DEB)4.432 E
(UG)-.1 E F0(and)4.432 E F1(RETURN)184 714 Q F0
(traps are normally not inherited in such cases.)2.5 E(GNU Bash-4.2)72
768 Q(2004 Apr 20)148.735 E(16)198.725 E 0 Cg EP
(traps are normally not inherited in such cases.)2.5 E(GNU Bash 5.0)72
768 Q(2004 Apr 20)149.565 E(16)198.725 E 0 Cg EP
%%Page: 17 17
%%BeginPageSetup
BP
@@ -2319,8 +2319,8 @@ F1(cdable_v)144 610.8 Q(ars)-.1 E F0 .156(If set, an ar)184 622.8 R .156
E F0 .736(checks that a command found in the hash table e)3.237 F .736
(xists before trying to e)-.15 F -.15(xe)-.15 G(-).15 E(cute it.)184
718.8 Q(If a hashed command no longer e)5 E
(xists, a normal path search is performed.)-.15 E(GNU Bash-4.2)72 768 Q
(2004 Apr 20)148.735 E(17)198.725 E 0 Cg EP
(xists, a normal path search is performed.)-.15 E(GNU Bash 5.0)72 768 Q
(2004 Apr 20)149.565 E(17)198.725 E 0 Cg EP
%%Page: 18 18
%%BeginPageSetup
BP
@@ -2431,8 +2431,8 @@ haracters that will be quoted in completed \214lenames when these)184
(ariable references in w)-.25 F .029(ords to be completed.)-.1 F .029
(This means)5.029 F 2.91(that dollar signs in v)184 720 R 2.909
(ariable names that e)-.25 F 2.909
(xpand to directories will not be quoted;)-.15 F(GNU Bash-4.2)72 768 Q
(2004 Apr 20)148.735 E(18)198.725 E 0 Cg EP
(xpand to directories will not be quoted;)-.15 F(GNU Bash 5.0)72 768 Q
(2004 Apr 20)149.565 E(18)198.725 E 0 Cg EP
%%Page: 19 19
%%BeginPageSetup
BP
@@ -2550,7 +2550,7 @@ E F0 .519(used in a pathname e)3.019 F .519(xpansion conte)-.15 F .518
(or more directories and subdirectories.)184 708 R .431
(If the pattern is follo)5.431 F .432(wed by a)-.25 F F1(/)2.932 E F0
2.932(,o)C .432(nly directories)-2.932 F(and subdirectories match.)184
720 Q(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(19)198.725 E 0 Cg EP
720 Q(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(19)198.725 E 0 Cg EP
%%Page: 20 20
%%BeginPageSetup
BP
@@ -2644,7 +2644,7 @@ le completions as part of programmable com-)-.15 F(pletion.)184 672 Q F1
3.354 G .854(thname Expansion).1 F F0(abo)3.354 E -.15(ve)-.15 G 3.354
(\)t).15 G(o)-3.354 E -.15(ex)184 708 S
(pand to a null string, rather than themselv).15 E(es.)-.15 E
(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(20)198.725 E 0 Cg EP
(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(20)198.725 E 0 Cg EP
%%Page: 21 21
%%BeginPageSetup
BP
@@ -2744,7 +2744,7 @@ F .37(xpression is true if and only if the second ar)-.15 F .37
(ve u)-.15 H(nder).15 E F2(CONDITION)3.355 E .855(AL EXPRESSIONS)-.18 F
F4(,)A F0(the)3.104 E .578(result of the e)180 722.4 R .578(xpression i\
s the result of the binary test using the \214rst and third ar)-.15 F
(guments)-.18 E(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(21)198.725 E
(guments)-.18 E(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(21)198.725 E
0 Cg EP
%%Page: 22 22
%%BeginPageSetup
@@ -2891,7 +2891,7 @@ F F0 -.1(wo)2.613 G .113(uld not return).1 F F2(\214le)2.613 E F0 5.113
F .731
(alue, which is not necessarily the \214le that appears \214rst in)-.25
F F3 -.666(PA)3.231 G(TH)-.189 E F4(.)A F0 .731(If the)5.231 F
(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(22)198.725 E 0 Cg EP
(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(22)198.725 E 0 Cg EP
%%Page: 23 23
%%BeginPageSetup
BP
@@ -3006,7 +3006,7 @@ pted by)144 650.4 R F2 -.15(ch)2.566 G(mod).15 E F0(\(1\).).77 E(If)144
F .552(The return status is 0 if the)5.552 F(mode w)144 698.4 Q
(as successfully changed or if no)-.1 E F2(mode)2.5 E F0(ar)2.5 E
(gument w)-.18 E(as supplied, and f)-.1 E(alse otherwise.)-.1 E
(GNU Bash-4.2)72 768 Q(2004 Apr 20)148.735 E(23)198.725 E 0 Cg EP
(GNU Bash 5.0)72 768 Q(2004 Apr 20)149.565 E(23)198.725 E 0 Cg EP
%%Page: 24 24
%%BeginPageSetup
BP
@@ -3078,8 +3078,8 @@ E F2(id)3.266 E F0 .756(speci\214es a non-e)4.026 F .756
R .365(Otherwise, the return status is the e)5.365 F .365
(xit status of the last process or job w)-.15 F(aited)-.1 E(for)144
357.6 Q(.)-.55 E/F5 10.95/Times-Bold@0 SF(SEE ALSO)72 374.4 Q F0
(bash\(1\), sh\(1\))108 386.4 Q(GNU Bash-4.2)72 768 Q(2004 Apr 20)
148.735 E(24)198.725 E 0 Cg EP
(bash\(1\), sh\(1\))108 386.4 Q(GNU Bash 5.0)72 768 Q(2004 Apr 20)
149.565 E(24)198.725 E 0 Cg EP
%%Trailer
end
%%EOF
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Fri Mar 2 16:08:28 2018
%%CreationDate: Thu Mar 15 14:13:34 2018
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 3
+4 -4
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Mar 2 16:08:12 EST 2018
@set LASTCHANGE Thu Mar 15 11:29:49 EDT 2018
@set EDITION 4.4
@set VERSION 4.4
@set EDITION 5.0
@set VERSION 5.0
@set UPDATED 2 March 2018
@set UPDATED 15 March 2018
@set UPDATED-MONTH March 2018
+3 -1
View File
@@ -1873,7 +1873,9 @@ Next, the string specified as the argument to the @option{-W} option
is considered.
The string is first split using the characters in the @env{IFS}
special variable as delimiters.
Shell quoting is honored.
Shell quoting is honored within the string, in order to provide a
mechanism for the words to contain shell metacharacters or characters
in the value of @env{IFS}.
Each word is then expanded using
brace expansion, tilde expansion, parameter and variable expansion,
command substitution, and arithmetic expansion,
+10 -2
View File
@@ -595,6 +595,7 @@ quoted_strlen (s)
}
#endif
#ifdef INCLUDE_UNUSED
/* Find the first occurrence of character C in string S, obeying shell
quoting rules. If (FLAGS & ST_BACKSL) is non-zero, backslash-escaped
characters are skipped. If (FLAGS & ST_CTLESC) is non-zero, characters
@@ -622,7 +623,6 @@ quoted_strchr (s, c, flags)
return ((char *)NULL);
}
#if defined (INCLUDE_UNUSED)
/* Return 1 if CHARACTER appears in an unquoted portion of
STRING. Return 0 otherwise. CHARACTER must be a single-byte character. */
static int
@@ -4608,6 +4608,9 @@ remove_pattern (param, pattern, op)
wchar_t *wparam, *wpattern;
mbstate_t ps;
/* XXX - could optimize here by checking param and pattern for multibyte
chars with mbsmbchar and calling remove_upattern. */
n = xdupmbstowcs (&wpattern, NULL, pattern);
if (n == (size_t)-1)
{
@@ -11315,11 +11318,16 @@ expand_word_list_internal (list, eflags)
if (assign_func == do_word_assignment)
{
last_command_exit_value = EXECUTION_FAILURE;
if (interactive_shell == 0 && posixly_correct && is_special_builtin)
if (interactive_shell == 0 && posixly_correct)
exp_jump_to_top_level (FORCE_EOF);
else
exp_jump_to_top_level (DISCARD);
}
else if (interactive_shell == 0 && is_special_builtin)
{
last_command_exit_value = EXECUTION_FAILURE;
exp_jump_to_top_level (FORCE_EOF);
}
else
tempenv_assign_error++;
}
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/bash/bash-current
BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+2 -1
View File
@@ -259,4 +259,5 @@ efg
42
42
42
./arith.tests: line 313: b[c]d: syntax error in expression (error token is "d")
./arith.tests: line 314: 'foo' : syntax error: operand expected (error token is "'foo' ")
./arith.tests: line 318: b[c]d: syntax error in expression (error token is "d")
+5
View File
@@ -309,5 +309,10 @@ printf "%u\n" $n
echo $(( 16#$(printf "%x\n" $n) ))
echo $(( 16#$(printf "%X\n" $n) ))
# these are errors
foo=1
echo $(( 'foo' ))
# causes longjmp botches through bash-2.05b
a[b[c]d]=e
+18 -18
View File
@@ -26,7 +26,7 @@ hello world
11
3
bdef hello world test expression test 2
./array.tests: line 76: readonly: `a[5]': not a valid identifier
./array.tests: line 79: readonly: `a[5]': not a valid identifier
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
declare -ar c
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
@@ -46,17 +46,17 @@ declare -ar c
declare -a d=([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")
declare -a e=([0]="test")
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
./array.tests: line 100: a: readonly variable
./array.tests: line 102: b[]: bad array subscript
./array.tests: line 103: b[*]: bad array subscript
./array.tests: line 104: ${b[ ]}: bad substitution
./array.tests: line 106: c[-2]: bad array subscript
./array.tests: line 107: c: bad array subscript
./array.tests: line 103: a: readonly variable
./array.tests: line 105: b[]: bad array subscript
./array.tests: line 106: b[*]: bad array subscript
./array.tests: line 107: ${b[ ]}: bad substitution
./array.tests: line 109: c[-2]: bad array subscript
./array.tests: line 110: c: bad array subscript
./array.tests: line 109: d[7]: cannot assign list to array member
./array.tests: line 111: []=abcde: bad array subscript
./array.tests: line 111: [*]=last: cannot assign to non-numeric index
./array.tests: line 111: [-65]=negative: bad array subscript
./array.tests: line 112: d[7]: cannot assign list to array member
./array.tests: line 114: []=abcde: bad array subscript
./array.tests: line 114: [*]=last: cannot assign to non-numeric index
./array.tests: line 114: [-65]=negative: bad array subscript
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
@@ -68,8 +68,8 @@ declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
declare -ar c
declare -a d=([1]="test test")
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
./array.tests: line 119: unset: ps1: not an array variable
./array.tests: line 123: declare: c: cannot destroy array variables in this way
./array.tests: line 122: unset: ps1: not an array variable
./array.tests: line 126: declare: c: cannot destroy array variables in this way
this of
this is a test of read using arrays
this test
@@ -127,7 +127,7 @@ grep [ 123 ] *
6 7 9 5
length = 3
value = new1 new2 new3
./array.tests: line 239: narray: unbound variable
./array.tests: line 242: narray: unbound variable
./array1.sub: line 1: syntax error near unexpected token `('
./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
@@ -154,10 +154,10 @@ for case if then else
12 14 16 18 20
4414758999202
aaa bbb
./array.tests: line 289: syntax error near unexpected token `<>'
./array.tests: line 289: `metas=( <> < > ! )'
./array.tests: line 290: syntax error near unexpected token `<>'
./array.tests: line 290: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
./array.tests: line 292: syntax error near unexpected token `<>'
./array.tests: line 292: `metas=( <> < > ! )'
./array.tests: line 293: syntax error near unexpected token `<>'
./array.tests: line 293: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
abc 3
case 4
abc case if then else 5
+3
View File
@@ -21,6 +21,9 @@ unset a
a=abcde
declare -a a
echo ${a[0]}
if [ "$a" != "${a[0]}" ]; then
echo 'array.tests: $a and $a[0] array mismatch'
fi
unset a
a=abcde
+7
View File
@@ -174,6 +174,13 @@ T='([a]=1)'
echo "${T[@]}"
unset T
# peculiar ksh93 semantics for unsubscripted assoc variable reference
declare -A T
T[0]='zero'
if [ "$T" != "${T[0]}" ]; then
echo 'assoc.tests: $T and ${T[0]} mismatch'
fi
${THIS_SH} ./assoc1.sub
${THIS_SH} ./assoc2.sub
+34 -2
View File
@@ -120,8 +120,9 @@ after readonly assignment
./errors4.sub: line 7: var: readonly variable
./errors5.sub: line 6: array: unbound variable
./errors5.sub: line 7: array: unbound variable
./errors5.sub: line 10: 7: unbound variable
./errors5.sub: line 8: array[7]: unbound variable
./errors5.sub: line 11: 7: unbound variable
./errors5.sub: line 12: 7: unbound variable
after 1: 1
after 2: 1
after 3: 1
@@ -136,6 +137,13 @@ array after 2: 1
./errors6.sub: line 27: -3: invalid variable name
after indir: 1
./errors6.sub: line 30: -3: invalid variable name
unset
./errors6.sub: line 37: var: invalid indirect expansion
./errors6.sub: line 38: var: invalid indirect expansion
./errors6.sub: line 41: invalid-ident: invalid variable name
./errors6.sub: line 42: invalid-ident: invalid variable name
./errors6.sub: line 43: invalid-ident: invalid variable name
./errors6.sub: uvar: parameter not set
./errors6.sub: uvar: parameter null or not set
@@ -145,4 +153,28 @@ after indir: 1
./errors6.sub: line 27: -3: invalid variable name
after indir: 1
./errors6.sub: line 30: -3: invalid variable name
./errors.tests: line 278: `!!': not a valid identifier
unset
./errors6.sub: line 37: var: invalid indirect expansion
./errors6.sub: line 38: var: invalid indirect expansion
./errors6.sub: line 41: invalid-ident: invalid variable name
./errors6.sub: line 42: invalid-ident: invalid variable name
./errors6.sub: line 43: invalid-ident: invalid variable name
./errors7.sub: line 8: x: readonly variable
./errors7.sub: line 8: notthere: command not found
after no such command: 127
./errors7.sub: line 10: x: readonly variable
echo builtin
after non-special builtin: 0
./errors7.sub: line 12: x: readonly variable
after special builtin: 0
./errors7.sub: line 14: x: readonly variable
./errors7.sub: line 8: x: readonly variable
./errors7.sub: line 8: notthere: command not found
after no such command: 127
./errors7.sub: line 10: x: readonly variable
echo builtin
after non-special builtin: 0
./errors7.sub: line 12: x: readonly variable
./errors7.sub: line 14: x: readonly variable
./errors.tests: line 281: `!!': not a valid identifier
+3
View File
@@ -270,6 +270,9 @@ ${THIS_SH} ./errors5.sub
${THIS_SH} ./errors6.sub
THIS_SH="${THIS_SH} -o posix" ${THIS_SH} ./errors6.sub
${THIS_SH} ./errors7.sub
${THIS_SH} -o posix ./errors7.sub
# this must be last!
# in posix mode, a function name must be a valid identifier
# this can't go in posix2.tests, since it causes the shell to exit
+1
View File
@@ -5,6 +5,7 @@ set -u
( echo ${#array} )
( echo ${array} )
( echo ${array[7]} )
set -- 1 2 3
( echo ${#7} )
+12
View File
@@ -29,3 +29,15 @@ echo after indir: $?
function ivar() { echo -n "${!1:-${1}}"; }
ivar -3
foo=bar
echo ${!foo}
echo ${!foo:-unset}
echo ${!var:-unset}
echo ${!var+unset}
foo=invalid-ident
echo ${!foo}
echo ${!foo:-unset}
echo ${!foo+unset}
+15
View File
@@ -0,0 +1,15 @@
: ${THIS_SH:=./bash}
readonly x=4
# in posix mode, these are all variable assignment errors, so strict conformance
# implies that we exit after any of them. ksh93 doesn't do that. we more-or-less
# emulate the ksh93 behavior
x=8 notthere
echo after no such command: $?
x=8 echo echo builtin
echo after non-special builtin: $?
( x=8 : nosuchdir
echo after special builtin: $? )
( x=8 $nocmd
echo after assignment error: $? )
+13
View File
@@ -388,3 +388,16 @@ ok 6
ok 7
ok 8
ok 9
argv[1] = <file.o>
argv[1] = <posix>
argv[1] = </src/cmd>
argv[1] = <three>
argv[1] = </one/two/three>
abcdefg
abcdefg
abcdefg
abcdefg
cdefg
abcdefg
abcde
abcdefg
+1
View File
@@ -407,3 +407,4 @@ ${THIS_SH} ./exp8.sub
${THIS_SH} ./exp9.sub
${THIS_SH} ./exp10.sub
${THIS_SH} ./exp11.sub
${THIS_SH} ./exp12.sub
+38
View File
@@ -0,0 +1,38 @@
# force single-byte versions of these functions
export LANG=C
# remove shortest trailing match
x=file.c
recho ${x%.c}.o
# remove longest trailing match
x=posix/src/std
recho ${x%%/*}
# remove shortest leading pattern
x=$HOME/src/cmd
recho ${x#$HOME}
# remove longest leading pattern
x=/one/two/three
recho ${x##*/}
# and no match thrown in for good measure
recho ${x#nomatch}
foo=abcdefg
# fail
echo ${foo%ab}
echo ${foo%def}
echo ${foo#fg}
echo ${foo#def}
# succeed
echo ${foo#ab}
echo ${foo#def}
echo ${foo%fg}
echo ${foo%def}
+1
View File
@@ -113,3 +113,4 @@ a b c
a b c
.x .y .z a b c
.x .y .z a b c
*
+2
View File
@@ -374,4 +374,6 @@ ${THIS_SH} ./extglob3.sub
${THIS_SH} ./extglob4.sub
${THIS_SH} ./extglob5.sub
exit 0
+17
View File
@@ -0,0 +1,17 @@
# globignore extglob patterns containing colons -- problem until bash-4.2
: ${TMPDIR:=/tmp}
TESTDIR=$TMPDIR/bash-globignore-$$
[ -d "$TESTDIR" ] || mkdir "$TESTDIR"
cd "$TESTDIR" || exit 2
shopt -s extglob
GLOBIGNORE='+([^[:alnum:]]):@([-.,:; _]):[![:alnum:]]'
touch ';' '++'
echo *
rm ';' '++'
cd $OLDPWD
+9
View File
@@ -181,6 +181,15 @@ echo g
g
eval echo "echo g"
echo g
h
echo \!\! `echo echo h`
!! echo h
i
echo echo i `echo echo i`
echo i echo i
j
echo `echo j` echo j
j echo j
a
cat < <(echo echo a)
echo a
+9
View File
@@ -31,5 +31,14 @@ echo "!!"
echo g
eval echo "!!"
echo h
echo \!\! `echo !!`
echo i
echo !! `echo !!`
echo j
echo `echo j` !!
set +o history
rm -f $HISTFILE # just in case
+2 -2
View File
@@ -152,7 +152,7 @@ b1()
b2()
{
recho $*
recho $#
recho ${#}
}
expect '<1>'
@@ -414,7 +414,7 @@ recho ${#}
expect '<5>'
recho ${#?:-xyz}
shift $#
shift ${#}
expect '<0>'
recho ${#:-foo}
+7
View File
@@ -226,6 +226,13 @@ declare -r RO="x"
./nameref11.sub: line 39: declare: RO_PID: not found
./nameref11.sub: line 41: RO2: readonly variable
declare -r RO2="a"
2
./nameref11.sub: line 52: typeset: `2': invalid variable name for name reference
2
./nameref11.sub: line 57: typeset: `2': invalid variable name for name reference
2
./nameref11.sub: line 62: foo[2]: invalid indirect expansion
./nameref11.sub: line 63: bar: invalid indirect expansion
./nameref12.sub: line 6: declare: `/': invalid variable name for name reference
./nameref12.sub: line 9: declare: `%': invalid variable name for name reference
./nameref12.sub: line 13: `^': not a valid identifier
+22
View File
@@ -39,3 +39,25 @@ unset -n ref ; unset ref
declare -r RO RO_PID; coproc RO { :; }; declare -p RO_PID; wait; declare -p RO RO_PID
declare -r RO2=a; declare -n ref_PID=RO2; coproc ref { :; }; wait; declare -p RO2
unset x y
set -- one two three
y=2
typeset -n x=y
echo ${x}
unset -n x
typeset -n y
echo $y
unset -n y
typeset -n y
y=2
echo ${y}
declare -n foo=bar
echo ${!foo[2]}
echo ${!bar}
+22 -1
View File
@@ -169,6 +169,7 @@ lines.
This-string-has-multiple-lines.
this is a test of proc subst
this is test 2
a
./new-exp2.sub: line 42: /tmp/redir-notthere: No such file or directory
1
@@ -642,6 +643,26 @@ ir
a b c d e
5
a5b
abcxxxdef
abcådef
ḅć
Ã¥
prependḅć
Ã¥append
prependå
ḅćappend
Ã¥
ḅć
ḅć
ḅć
Ã¥
Ã¥
Ã¥
ḅć
Ã¥
Ã¥
ḅć
ḅć
argv[1] = </>
argv[1] = </>
./new-exp.tests: line 608: ABXD: parameter unset
./new-exp.tests: line 611: ABXD: parameter unset
+5 -2
View File
@@ -340,7 +340,7 @@ recho "${foo:-$@}"
expect '<ab> <cd> <ef> <gh>'
recho "${foo:-"$@"}"
shift $#
shift ${#}
expect nothing
recho $xxx"$@"
expect nothing
@@ -498,7 +498,7 @@ recho ${*%?}
recho ${@#?}
recho ${*#?}
shift $#
shift ${#}
set -u
( recho $9 ; echo after 1)
( recho ${9} ; echo after 2)
@@ -597,6 +597,9 @@ ${THIS_SH} ./new-exp9.sub
# new parameter transformation `@' expansion operator
${THIS_SH} ./new-exp10.sub
# parameter substring replacement and removal operators with multibyte chars
${THIS_SH} ./new-exp11.sub
# problems with stray CTLNUL in bash-4.0-alpha
unset a
a=/a
+4
View File
@@ -10,3 +10,7 @@ echo this is test 2 > $FN
expect this is test 2
cat <(cat $FN)
rm -f $FN
foo=
expect a
cat ${foo:-<(echo a)}
+46
View File
@@ -0,0 +1,46 @@
# pattern matching and replacement operators with multibyte characters
LANG=en_US.UTF-8
s1='abcådef'
s2='Ã¥'
s3='ḅć'
s23=${s2}${s3}
echo ${s1/$s2/xxx}
echo ${s1/$s3/xxx}
echo ${s23/#$s2/}
echo ${s23/%$s3/}
echo ${s23/#$s2/prepend}
echo ${s23/%$s3/append}
echo ${s2/#/prepend}
echo ${s3/%/append}
echo ${s2/#/}
echo ${s3/%/}
recho ${s2/$s2/}
recho ${s3/$s3/}
# posix pattern replacements
echo ${s23##$s2}
echo ${s23#$s2}
echo ${s23%%$s3}
echo ${s23%$s3}
# fail
echo ${s2/#ab/xx}
echo ${s3/%ab/xx}
echo ${s2#ab}
echo ${s2##ab}
echo ${s3%ab}
echo ${s3%%ab}
+3
View File
@@ -18,4 +18,7 @@ ${THIS_SH} -c 'echo ${1?}' 2>/dev/null && exit 11
${THIS_SH} -c 'echo ${1?}' ${THIS_SH} x >/dev/null || exit 12
${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x 2>/dev/null && exit 13
${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x y >/dev/null || exit 14
${THIS_SH} -c $'echo $(( x+ )) \n exit 0' ${THIS_SH} 2>/dev/null && exit 15
exit 0
+6
View File
@@ -66,6 +66,12 @@ argv[2] = <ab>
${
argv[1] = <(")>
argv[1] = <(")>
string \
string \
string \
string \
string \
string \}
'weferfds'\''dsfsdf'
'weferfdsdsfsdf'
'weferfds'\''dsfsdf'
+11
View File
@@ -109,4 +109,15 @@ recho `echo "(\\")"`
# ultimate workaround
recho `echo "(\")"`
# various strings ending in backslashes
echo 'string \'
echo "string \\"
echo string\ \\
echo ${foo:-'string \'}
echo "${foo:-string \\}"
echo ${foo:-string \\\}}
${THIS_SH} ./quote1.sub
+4
View File
@@ -26,6 +26,10 @@
+ x=i
+ case x in
+ x=i
+ foo=one
+ foo+=two
+ echo onetwo
onetwo
+ set +x
1
2
+5
View File
@@ -14,6 +14,11 @@ case x in
0) x=i ;;
*) x=i ;;
esac
foo=one
foo+=two
echo $foo
set +x
# test BASH_XTRACEFD
+7
View File
@@ -128,6 +128,13 @@ outer: res: X Y
main: after second call: X
func: null or unset
after func: x = outside
./varenv11.sub: line 4: local: qux: readonly variable
./varenv11.sub: line 5: qux: readonly variable
declare -A foo=([one]="one" [zero]="zero" )
declare -a bar=([0]="zero" [1]="one")
declare -A foo=([one]="one" [zero]="zero" )
declare -a bar=([0]="zero" [1]="one")
./varenv11.sub: line 29: a: readonly variable
a=z
a=b
a=z
+3
View File
@@ -228,5 +228,8 @@ ${THIS_SH} ./varenv9.sub
# more tests of unset and local variables with dynamic scoping
${THIS_SH} ./varenv10.sub
# tests of compound assignments in function scope
${THIS_SH} ./varenv11.sub
# make sure variable scoping is done right
tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a
+30
View File
@@ -0,0 +1,30 @@
# couple of errors here
func()
{
local qux=7
local qux=(one two)
local what=(zero one two)
}
readonly qux=42
func
func2()
{
declare -gA foo=([zero]=zero [one]=one)
declare -ga bar=(zero one)
}
foo=help
bar=me
func2
declare -p foo bar
unset foo bar
func2
declare -p foo bar
readonly a=7
a=(1 2 3)