commit bash-20170407 snapshot

This commit is contained in:
Chet Ramey
2017-04-10 16:25:57 -04:00
parent 7c4ef411b5
commit 1a5fa30baf
43 changed files with 14065 additions and 13436 deletions
+82
View File
@@ -13582,3 +13582,85 @@ subst.c
- parameter_brace_substring: if expanding an unquoted $* on the rhs of
an assignment statement when IFS is null, make sure we expand the $*
as if it were quoted
4/4
---
doc/{bash.1,bashref.texi}
- read: document that a delim argument of '' terminates each line when
a NUL character appears
4/5
---
subst.c
- parameter_brace_expand_word: handle case where unquoted $@ is
expanded in a context where word splitting is not performed (PF_NOSPLIT2)
and IFS is not equal to the standard value
- param_expand: handle case where unquoted $@ is expanded in a context
where word splitting is not performed (PF_NOSPLIT2) and IFS is not
equal to the standard value. Fixes bug with IFS == $1 when expanding
unquoted $@ reported by Grisha Levit <grishalevit@gmail.com>
4/7
---
subst.c
- pos_params_pat_subst: if MATCH_ASSIGNRHS is set, don't expand $*
as quoted unless expand_no_split_dollar_star is also set. Fixes
expansion bug reported on 4/4 by Grisha Levit <grishalevit@gmail.com>
- parameter_brace_transform: if we transform unquoted A[@] or A[*]
when IFS is null, don't quote the result of array_transform in the
same way we don't quote the result of parameter_list_transform,
since it will come back quoted. Fixes bug reported by
Grisha Levit <grishalevit@gmail.com>
- list_transform: if we transform unquoted $* or ${a[*]} when IFS is
null and expand_no_split_dollar_star is non-zero, call
string_list_pos_params with Q_DOUBLE_QUOTES to inhibit splitting.
We do this in all cases except @Q, which is inconsistent but more
intuitive.
Fixes bug reported by Grisha Levit <grishalevit@gmail.com>
4/8
---
builtins/read.def
- read_mbchar: if unbuffered == 2, we are running read -N and need to
use zreadn to read the rest of the multibyte char, since the
previous call to zreadn may have buffered characters. Fixes bug
reported by Stephane Chazelas <stephane.chazelas@gmail.com>
pathexp.h
- QGLOB_CTLESC: new flag for quote_string_for_globbing: means to turn
CTLESC CTLESC (quoted CTLESC that's usually removed as part of
word splitting or quote removal) into CTLESC
pathexp.c
- quote_string_for_globbing: if QGLOB_CTLESC is present in flags,
turn CTLESC CTLESC into CTLESC, even if the first CTLESC is preceded
by a backslash. Callers can't do this because the remaining CTLESC
will be treated as a quoting character and turned into a backslash
execute_cmd.c
- execute_case_command: if the pattern is not quoted, make sure to tell
quote_string_for_globbing to turn CTLESC CTLESC into CTLESC by
passing QGLOB_CTLESC. Fixes bug reported 4/2 by Martijn Dekker
<martijn@inlv.org>
4/9
---
subst.c
- string_transform: after calling ansiexpand for the `E' transformation,
need to call dequote_escapes because ansiexpand assumes it is being
called by the parser and arranges for ansicstr to quote CTLESC and
CTLNUL with CTLESC. Reported by Grisha Levit <grishalevit@gmail.com>
variables.c
- mk_env_string: when exporting functions, run them through
dequote_escapes because any strings containing CTLESC or CTLNUL are
still quoted with CTLESC. Reported by Grisha Levit
<grishalevit@gmail.com>
subst.[ch]
- quote_escapes,dequote_escapes: now take const char * argument
execute_cmd.c
- execute_intern_function: if the function name contains CTLESC, run
it through dequote_escapes just in case it got CTLESC quoting
CTLESC or CTLNUL from the parser
+7 -15
View File
@@ -57,8 +57,6 @@ code directory by typing 'make clean'. To also remove the files that
'configure' created (so you can compile Bash for a different kind of
computer), type 'make distclean'.
Next: Compiling For Multiple Architectures, Prev: Basic Installation, Up: Installing Bash
Compilers and Options
=====================
@@ -76,8 +74,6 @@ On systems that have the 'env' program, you can do it like this:
The configuration process uses GCC to build Bash if it is available.
Next: Installation Names, Prev: Compilers and Options, Up: Installing Bash
Compiling For Multiple Architectures
====================================
@@ -108,8 +104,6 @@ The 'mkclone' script requires Bash, so you must have already built Bash
for at least one architecture before you can create build directories
for other architectures.
Next: Specifying the System Type, Prev: Compiling For Multiple Architectures, Up: Installing Bash
Installation Names
==================
@@ -125,8 +119,6 @@ option '--exec-prefix=PATH', 'make install' will use PATH as the prefix
for installing programs and libraries. Documentation and other data
files will still use the regular prefix.
Next: Sharing Defaults, Prev: Installation Names, Up: Installing Bash
Specifying the System Type
==========================
@@ -140,8 +132,6 @@ canonical name with three fields: 'CPU-COMPANY-SYSTEM' (e.g.,
See the file 'support/config.sub' for the possible values of each field.
Next: Operation Controls, Prev: Specifying the System Type, Up: Installing Bash
Sharing Defaults
================
@@ -154,8 +144,6 @@ looks for 'PREFIX/share/config.site' if it exists, then
A warning: the Bash 'configure' looks for a site script, but not all
'configure' scripts do.
Next: Optional Features, Prev: Sharing Defaults, Up: Installing Bash
Operation Controls
==================
@@ -185,8 +173,6 @@ Operation Controls
'configure' also accepts some other, not widely used, boilerplate
options. 'configure --help' prints the complete list.
Prev: Operation Controls, Up: Installing Bash
Optional Features
=================
@@ -321,6 +307,12 @@ unless the operating system does not provide the necessary support.
'--enable-debugger'
Include support for the bash debugger (distributed separately).
'--enable-dev-fd-stat-broken'
If calling 'stat' on /dev/fd/N returns different results than
calling 'fstat' on file descriptor N, supply this option to enable
a workaround. This has implications for conditional commands that
test file attributes.
'--enable-direxpand-default'
Cause the 'direxpand' shell option (*note The Shopt Builtin::) to
be enabled by default when the shell starts. It is normally
@@ -391,7 +383,7 @@ unless the operating system does not provide the necessary support.
'--enable-prompt-string-decoding'
Turn on the interpretation of a number of backslash-escaped
characters in the '$PS1', '$PS2', '$PS3', and '$PS4' prompt
characters in the '$PS0', '$PS1', '$PS2', and '$PS4' prompt
strings. See *note Controlling the Prompt::, for a complete list
of prompt string escape sequences.
+4
View File
@@ -894,6 +894,7 @@ tests/source7.sub f
tests/case.tests f
tests/case.right f
tests/case1.sub f
tests/case2.sub f
tests/casemod.tests f
tests/casemod.right f
tests/comsub.tests f
@@ -997,6 +998,7 @@ tests/exp7.sub f
tests/exp8.sub f
tests/exp9.sub f
tests/exp10.sub f
tests/exp11.sub f
tests/exportfunc.tests f
tests/exportfunc.right f
tests/exportfunc1.sub f
@@ -1150,6 +1152,8 @@ tests/posixexp.tests f
tests/posixexp.right f
tests/posixexp1.sub f
tests/posixexp2.sub f
tests/posixexp3.sub f
tests/posixexp4.sub f
tests/posixexp2.tests f
tests/posixexp2.right f
tests/posixpat.tests f
+47 -40
View File
@@ -58,158 +58,165 @@ The following list is what's changed when 'POSIX mode' is in effect:
14. POSIX special builtins are found before shell functions during
command lookup.
15. Literal tildes that appear as the first character in elements of
15. When printing shell function definitions (e.g., by 'type'), Bash
does not print the 'function' keyword.
16. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
16. The 'time' reserved word may be used by itself as a command. When
17. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
17. When parsing and expanding a ${...} expansion that appears within
18. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
18. The parser does not recognize 'time' as a reserved word if the
19. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
19. The '!' character does not introduce history expansion within a
20. The '!' character does not introduce history expansion within a
double-quoted string, even if the 'histexpand' option is enabled.
20. If a POSIX special builtin returns an error status, a
21. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
21. A non-interactive shell exits with an error status if a variable
22. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
22. A non-interactive shell exits with an error status if a variable
23. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command.
23. A non-interactive shell exits with an error status if the
24. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
24. Non-interactive shells exit if FILENAME in '.' FILENAME is not
25. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
25. Non-interactive shells exit if a syntax error in an arithmetic
26. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
26. Non-interactive shells exit on word expansion errors.
27. Non-interactive shells exit if a parameter expansion error occurs.
27. Non-interactive shells exit if there is a syntax error in a script
28. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
28. Process substitution is not available.
29. Process substitution is not available.
29. While variable indirection is available, it may not be applied to
30. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
30. Assignment statements preceding POSIX special builtins persist in
31. When expanding the '*' special parameter in a pattern context
where the expansion is double-quoted does not treat the '$*' as if
it were double-quoted.
32. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
31. Assignment statements preceding shell function calls persist in
33. Assignment statements preceding shell function calls persist in
the shell environment after the function returns, as if a POSIX
special builtin command had been executed.
32. The 'command' builtin does not prevent builtins that take
34. The 'command' builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by 'command'.
33. The 'bg' builtin uses the required format to describe each job
35. The 'bg' builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
34. The output of 'kill -l' prints all the signal names on a single
36. The output of 'kill -l' prints all the signal names on a single
line, separated by spaces, without the 'SIG' prefix.
35. The 'kill' builtin does not accept signal names with a 'SIG'
37. The 'kill' builtin does not accept signal names with a 'SIG'
prefix.
36. The 'export' and 'readonly' builtin commands display their output
38. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
37. The 'trap' builtin displays signal names without the leading
39. The 'trap' builtin displays signal names without the leading
'SIG'.
38. The 'trap' builtin doesn't check the first argument for a possible
40. The 'trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use '-' as the first argument.
39. The '.' and 'source' builtins do not search the current directory
41. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
40. Enabling POSIX mode has the effect of setting the
42. Enabling POSIX mode has the effect of setting the
'inherit_errexit' option, so subshells spawned to execute command
substitutions inherit the value of the '-e' option from the parent
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
41. When the 'alias' builtin displays alias definitions, it does not
43. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
42. When the 'set' builtin is invoked without options, it does not
44. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
43. When the 'set' builtin is invoked without options, it displays
45. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
44. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
46. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to PHYSICAL mode.
45. The 'pwd' builtin verifies that the value it prints is the same as
47. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
46. When listing the history, the 'fc' builtin does not include an
48. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
47. The default editor used by 'fc' is 'ed'.
49. The default editor used by 'fc' is 'ed'.
48. The 'type' and 'command' builtins will not report a non-executable
50. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
49. The 'vi' editing mode will invoke the 'vi' editor directly when
51. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
50. When the 'xpg_echo' option is enabled, Bash does not attempt to
52. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
51. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
53. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
52. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
54. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
53. The 'read' builtin may be interrupted by a signal for which a trap
55. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
54. Bash removes an exited background process's status from the list
56. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
There is other POSIX behavior that Bash does not implement by default
+3 -1
View File
@@ -968,7 +968,9 @@ read_mbchar (fd, string, ind, ch, unbuffered)
{
ps = ps_back;
/* We don't want to be interrupted during a multibyte char read */
if (unbuffered)
if (unbuffered == 2)
r = zreadn (fd, &c, 1);
else if (unbuffered)
r = zread (fd, &c, 1);
else
r = zreadc (fd, &c);
+2627 -2614
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Wed Mar 22 15:35:08 EDT 2017
.\" Last Change: Tue Apr 4 14:55:46 EDT 2017
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2017 March 22" "GNU Bash 4.4"
.TH BASH 1 "2017 April 4" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -8768,6 +8768,8 @@ Options, if supplied, have the following meanings:
.B \-d
The first character of \fIdelim\fP is used to terminate each input line,
rather than newline.
If \fIdelim\fP is the empty string, \fBread\fP will terminate a line
when it reads a NUL character.
.TP
.B \-n
Copy at most
+22 -4
View File
@@ -780,6 +780,12 @@ the time information.
Each command in a pipeline is executed as a separate process (i.e., in a
subshell).
See
<FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B></FONT>
for a description of a subshell environment.
If the <B>lastpipe</B> option is enabled using the <B>shopt</B> builtin
(see the description of <B>shopt</B> below),
the last element of a pipeline may be run by the shell process.
<A NAME="lbAN">&nbsp;</A>
<H4>Lists</H4>
@@ -855,7 +861,7 @@ An AND list has the form
is executed if, and only if,
<I>command1</I>
returns an exit status of zero.
returns an exit status of zero (success).
<P>
An OR list has the form
@@ -1463,7 +1469,7 @@ question mark
<DD>
the eight-bit character whose value is the octal value <I>nnn</I>
(one to three digits)
(one to three octal digits)
<DT><B>\x</B><I>HH</I>
<DD>
@@ -3388,10 +3394,12 @@ The
<B>unset</B>
builtin is used to destroy arrays. <B>unset</B> <I>name</I>[<I>subscript</I>]
destroys the array element at index <I>subscript</I>.
destroys the array element at index <I>subscript</I>,
for both indexed and associative arrays.
Negative subscripts to indexed arrays are interpreted as described above.
Care must be taken to avoid unwanted side effects caused by pathname
expansion.
Unsetting the last element of an array variable does not unset the variable.
<B>unset</B> <I>name</I>, where <I>name</I> is an array, or
<B>unset</B> <I>name</I>[<I>subscript</I>], where
<I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
@@ -5452,6 +5460,16 @@ local variable <I>var</I> from <I>func1</I>, shadowing any global variable
named <I>var</I>.
<P>
The <B>unset</B> builtin also acts using the same dynamic scope: if a
variable is local to the current scope, <B>unset</B> will unset it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the local scope is unset, it will remain so
until it is reset in that scope or until the function returns.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
<P>
The <B>FUNCNEST</B> variable, if set to a numeric value greater
than 0, defines a maximum function nesting level. Function
invocations that exceed the limit cause the entire command to
@@ -13820,6 +13838,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 22 March 2017 16:12:40 EDT
Time: 03 April 2017 16:34:05 EDT
</BODY>
</HTML>
+177 -159
View File
@@ -451,7 +451,7 @@ decoded as follows:
question mark
'\NNN'
the eight-bit character whose value is the octal value NNN (one to
three digits)
three octal digits)
'\xHH'
the eight-bit character whose value is the hexadecimal value HH
(one or two hex digits)
@@ -586,16 +586,20 @@ information.
If the pipeline is not executed asynchronously (*note Lists::), the
shell waits for all commands in the pipeline to complete.
Each command in a pipeline is executed in its own subshell (*note
Command Execution Environment::). The exit status of a pipeline is the
exit status of the last command in the pipeline, unless the 'pipefail'
option is enabled (*note The Set Builtin::). If 'pipefail' is enabled,
the pipeline's return status is the value of the last (rightmost)
command to exit with a non-zero status, or zero if all commands exit
successfully. If the reserved word '!' precedes the pipeline, the exit
status is the logical negation of the exit status as described above.
The shell waits for all commands in the pipeline to terminate before
returning a value.
Each command in a pipeline is executed in its own subshell, which is
a separate process (*note Command Execution Environment::). If the
'lastpipe' option is enabled using the 'shopt' builtin (*note The Shopt
Builtin::), the last element of a pipeline may be run by the shell
process.
The exit status of a pipeline is the exit status of the last command
in the pipeline, unless the 'pipefail' option is enabled (*note The Set
Builtin::). If 'pipefail' is enabled, the pipeline's return status is
the value of the last (rightmost) command to exit with a non-zero
status, or zero if all commands exit successfully. If the reserved word
'!' precedes the pipeline, the exit status is the logical negation of
the exit status as described above. The shell waits for all commands in
the pipeline to terminate before returning a value.

File: bash.info, Node: Lists, Next: Compound Commands, Prev: Pipelines, Up: Shell Commands
@@ -633,7 +637,7 @@ executed with left associativity.
COMMAND1 && COMMAND2
COMMAND2 is executed if, and only if, COMMAND1 returns an exit status of
zero.
zero (success).
An OR list has the form
COMMAND1 || COMMAND2
@@ -656,11 +660,12 @@ File: bash.info, Node: Compound Commands, Next: Coprocesses, Prev: Lists, Up
* Conditional Constructs:: Shell commands for conditional execution.
* Command Grouping:: Ways to group commands.
Compound commands are the shell programming constructs. Each construct
begins with a reserved word or control operator and is terminated by a
corresponding reserved word or operator. Any redirections (*note
Redirections::) associated with a compound command apply to all commands
within that compound command unless explicitly overridden.
Compound commands are the shell programming language constructs. Each
construct begins with a reserved word or control operator and is
terminated by a corresponding reserved word or operator. Any
redirections (*note Redirections::) associated with a compound command
apply to all commands within that compound command unless explicitly
overridden.
In most cases a list of commands in a compound command's description
may be separated from the rest of the command by one or more newlines,
@@ -705,14 +710,16 @@ syntax, it may be replaced with one or more newlines.
for NAME [ [in [WORDS ...] ] ; ] do COMMANDS; done
Expand WORDS, and execute COMMANDS once for each member in the
resultant list, with NAME bound to the current member. If 'in
WORDS' is not present, the 'for' command executes the COMMANDS once
for each positional parameter that is set, as if 'in "$@"' had been
specified (*note Special Parameters::). The return status is the
exit status of the last command that executes. If there are no
items in the expansion of WORDS, no commands are executed, and the
return status is zero.
Expand WORDS (*note Shell Expansions::), and execute COMMANDS once
for each member in the resultant list, with NAME bound to the
current member. If 'in WORDS' is not present, the 'for' command
executes the COMMANDS once for each positional parameter that is
set, as if 'in "$@"' had been specified (*note Special
Parameters::).
The return status is the exit status of the last command that
executes. If there are no items in the expansion of WORDS, no
commands are executed, and the return status is zero.
An alternate form of the 'for' command is also supported:
@@ -764,20 +771,21 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev:
case WORD in [ [(] PATTERN [| PATTERN]...) COMMAND-LIST ;;]... esac
'case' will selectively execute the COMMAND-LIST corresponding to
the first PATTERN that matches WORD. 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. The '|' is used to separate
multiple patterns, and the ')' operator terminates a pattern list.
A list of patterns and an associated command-list is known as a
CLAUSE.
the first PATTERN that matches WORD. The match is performed
according to the rules described below in *note Pattern Matching::.
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. The '|' is
used to separate multiple patterns, and the ')' operator terminates
a pattern list. A list of patterns and an associated command-list
is known as a CLAUSE.
Each clause must be terminated with ';;', ';&', or ';;&'. The WORD
undergoes tilde expansion, parameter expansion, command
substitution, arithmetic expansion, and quote removal before
matching is attempted. Each PATTERN undergoes tilde expansion,
parameter expansion, command substitution, and arithmetic
expansion.
substitution, arithmetic expansion, and quote removal (*note Shell
Parameter Expansion::) before matching is attempted. Each PATTERN
undergoes tilde expansion, parameter expansion, command
substitution, and arithmetic expansion.
There may be an arbitrary number of 'case' clauses, each terminated
by a ';;', ';&', or ';;&'. The first pattern that matches
@@ -904,7 +912,7 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev:
variable LINE) if there is a sequence of characters in the value
consisting of any number, including zero, of space characters, zero
or one instances of 'a', then a 'b':
[[ $line =~ [[:space:]]*(a)?b ]]
[[ $line =~ [[:space:]]*?(a)b ]]
That means values like 'aab' and ' aaaaaab' will match, as will a
line containing a 'b' anywhere in its value.
@@ -917,7 +925,7 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev:
to the shell's quote removal. Using a shell variable to store the
pattern decreases these problems. For example, the following is
equivalent to the above:
pattern='[[:space:]]*(a)?b'
pattern='[[:space:]]*?(a)b'
[[ $line =~ $pattern ]]
If you want to match a character that's special to the regular
@@ -1252,6 +1260,14 @@ script displays
var=global
func1
The 'unset' builtin also acts using the same dynamic scope: if a
variable is local to the current scope, 'unset' will unset it; otherwise
the unset will refer to the variable found in any calling scope as
described above. If a variable at the local scope is unset, it will
remain so until it is reset in that scope or until the function returns.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
Function names and definitions may be listed with the '-f' option to
the 'declare' ('typeset') builtin command (*note Bash Builtins::). The
'-F' option to 'declare' or 'typeset' will list the function names only
@@ -6205,8 +6221,10 @@ quotes.
NAME[SUBSCRIPT]' destroys the array element at index SUBSCRIPT.
Negative subscripts to indexed arrays are interpreted as described
above. Care must be taken to avoid unwanted side effects caused by
filename expansion. 'unset NAME', where NAME is an array, removes the
entire array. A subscript of '*' or '@' also removes the entire array.
filename expansion. Unsetting the last element of an array variable
does not unset the variable. 'unset NAME', where NAME is an array,
removes the entire array. A subscript of '*' or '@' also removes the
entire array.
The 'declare', 'local', and 'readonly' builtins each accept a '-a'
option to specify an indexed array and a '-A' option to specify an
@@ -10854,9 +10872,9 @@ D.2 Index of Shell Reserved Words
* !: Pipelines. (line 9)
* [[: Conditional Constructs.
(line 121)
(line 122)
* ]]: Conditional Constructs.
(line 121)
(line 122)
* {: Command Grouping. (line 21)
* }: Command Grouping. (line 21)
* case: Conditional Constructs.
@@ -10878,7 +10896,7 @@ D.2 Index of Shell Reserved Words
* in: Conditional Constructs.
(line 28)
* select: Conditional Constructs.
(line 79)
(line 80)
* then: Conditional Constructs.
(line 7)
* time: Pipelines. (line 9)
@@ -11485,121 +11503,121 @@ Node: Escape Character14462
Node: Single Quotes14947
Node: Double Quotes15295
Node: ANSI-C Quoting16573
Node: Locale Translation17826
Node: Comments18722
Node: Shell Commands19340
Node: Simple Commands20212
Node: Pipelines20843
Node: Lists23586
Node: Compound Commands25315
Node: Looping Constructs26318
Node: Conditional Constructs28781
Node: Command Grouping39703
Node: Coprocesses41182
Node: GNU Parallel43014
Node: Shell Functions46987
Node: Shell Parameters53696
Node: Positional Parameters58109
Node: Special Parameters59009
Node: Shell Expansions62346
Node: Brace Expansion64440
Node: Tilde Expansion67274
Node: Shell Parameter Expansion69622
Node: Command Substitution83754
Node: Arithmetic Expansion85109
Node: Process Substitution86041
Node: Word Splitting87161
Node: Filename Expansion89105
Node: Pattern Matching91479
Node: Quote Removal95465
Node: Redirections95760
Node: Executing Commands105318
Node: Simple Command Expansion105988
Node: Command Search and Execution107918
Node: Command Execution Environment110254
Node: Environment113238
Node: Exit Status114897
Node: Signals116567
Node: Shell Scripts118534
Node: Shell Builtin Commands121049
Node: Bourne Shell Builtins123083
Node: Bash Builtins143683
Node: Modifying Shell Behavior172328
Node: The Set Builtin172673
Node: The Shopt Builtin183086
Node: Special Builtins198984
Node: Shell Variables199963
Node: Bourne Shell Variables200400
Node: Bash Variables202504
Node: Bash Features232297
Node: Invoking Bash233196
Node: Bash Startup Files239145
Node: Interactive Shells244248
Node: What is an Interactive Shell?244658
Node: Is this Shell Interactive?245307
Node: Interactive Shell Behavior246122
Node: Bash Conditional Expressions249610
Node: Shell Arithmetic253976
Node: Aliases256793
Node: Arrays259341
Node: The Directory Stack264425
Node: Directory Stack Builtins265209
Node: Controlling the Prompt268177
Node: The Restricted Shell270939
Node: Bash POSIX Mode272764
Node: Job Control283115
Node: Job Control Basics283575
Node: Job Control Builtins288543
Node: Job Control Variables293270
Node: Command Line Editing294426
Node: Introduction and Notation296097
Node: Readline Interaction297720
Node: Readline Bare Essentials298911
Node: Readline Movement Commands300694
Node: Readline Killing Commands301654
Node: Readline Arguments303572
Node: Searching304616
Node: Readline Init File306802
Node: Readline Init File Syntax307949
Node: Conditional Init Constructs328136
Node: Sample Init File330661
Node: Bindable Readline Commands333778
Node: Commands For Moving334982
Node: Commands For History336831
Node: Commands For Text341126
Node: Commands For Killing344515
Node: Numeric Arguments346996
Node: Commands For Completion348135
Node: Keyboard Macros352326
Node: Miscellaneous Commands353013
Node: Readline vi Mode358889
Node: Programmable Completion359796
Node: Programmable Completion Builtins367257
Node: A Programmable Completion Example377143
Node: Using History Interactively382395
Node: Bash History Facilities383079
Node: Bash History Builtins386080
Node: History Interaction390372
Node: Event Designators393336
Node: Word Designators394555
Node: Modifiers396192
Node: Installing Bash397594
Node: Basic Installation398731
Node: Compilers and Options401422
Node: Compiling For Multiple Architectures402163
Node: Installation Names403826
Node: Specifying the System Type404644
Node: Sharing Defaults405360
Node: Operation Controls406033
Node: Optional Features406991
Node: Reporting Bugs417517
Node: Major Differences From The Bourne Shell418711
Node: GNU Free Documentation License435563
Node: Indexes460740
Node: Builtin Index461194
Node: Reserved Word Index468021
Node: Variable Index470469
Node: Function Index486147
Node: Concept Index499450
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 Parallel43393
Node: Shell Functions47366
Node: Shell Parameters54565
Node: Positional Parameters58978
Node: Special Parameters59878
Node: Shell Expansions63215
Node: Brace Expansion65309
Node: Tilde Expansion68143
Node: Shell Parameter Expansion70491
Node: Command Substitution84623
Node: Arithmetic Expansion85978
Node: Process Substitution86910
Node: Word Splitting88030
Node: Filename Expansion89974
Node: Pattern Matching92348
Node: Quote Removal96334
Node: Redirections96629
Node: Executing Commands106187
Node: Simple Command Expansion106857
Node: Command Search and Execution108787
Node: Command Execution Environment111123
Node: Environment114107
Node: Exit Status115766
Node: Signals117436
Node: Shell Scripts119403
Node: Shell Builtin Commands121918
Node: Bourne Shell Builtins123952
Node: Bash Builtins144552
Node: Modifying Shell Behavior173197
Node: The Set Builtin173542
Node: The Shopt Builtin183955
Node: Special Builtins199853
Node: Shell Variables200832
Node: Bourne Shell Variables201269
Node: Bash Variables203373
Node: Bash Features233166
Node: Invoking Bash234065
Node: Bash Startup Files240014
Node: Interactive Shells245117
Node: What is an Interactive Shell?245527
Node: Is this Shell Interactive?246176
Node: Interactive Shell Behavior246991
Node: Bash Conditional Expressions250479
Node: Shell Arithmetic254845
Node: Aliases257662
Node: Arrays260210
Node: The Directory Stack265372
Node: Directory Stack Builtins266156
Node: Controlling the Prompt269124
Node: The Restricted Shell271886
Node: Bash POSIX Mode273711
Node: Job Control284062
Node: Job Control Basics284522
Node: Job Control Builtins289490
Node: Job Control Variables294217
Node: Command Line Editing295373
Node: Introduction and Notation297044
Node: Readline Interaction298667
Node: Readline Bare Essentials299858
Node: Readline Movement Commands301641
Node: Readline Killing Commands302601
Node: Readline Arguments304519
Node: Searching305563
Node: Readline Init File307749
Node: Readline Init File Syntax308896
Node: Conditional Init Constructs329083
Node: Sample Init File331608
Node: Bindable Readline Commands334725
Node: Commands For Moving335929
Node: Commands For History337778
Node: Commands For Text342073
Node: Commands For Killing345462
Node: Numeric Arguments347943
Node: Commands For Completion349082
Node: Keyboard Macros353273
Node: Miscellaneous Commands353960
Node: Readline vi Mode359836
Node: Programmable Completion360743
Node: Programmable Completion Builtins368204
Node: A Programmable Completion Example378090
Node: Using History Interactively383342
Node: Bash History Facilities384026
Node: Bash History Builtins387027
Node: History Interaction391319
Node: Event Designators394283
Node: Word Designators395502
Node: Modifiers397139
Node: Installing Bash398541
Node: Basic Installation399678
Node: Compilers and Options402369
Node: Compiling For Multiple Architectures403110
Node: Installation Names404773
Node: Specifying the System Type405591
Node: Sharing Defaults406307
Node: Operation Controls406980
Node: Optional Features407938
Node: Reporting Bugs418464
Node: Major Differences From The Bourne Shell419658
Node: GNU Free Documentation License436510
Node: Indexes461687
Node: Builtin Index462141
Node: Reserved Word Index468968
Node: Variable Index471416
Node: Function Index487094
Node: Concept Index500397

End Tag Table
BIN
View File
Binary file not shown.
+7193 -7184
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -60,7 +60,7 @@
@xrdef{Conditional Constructs-title}{Conditional Constructs}
@xrdef{Conditional Constructs-snt}{Section@tie 3.2.4.2}
@xrdef{Looping Constructs-pg}{10}
@xrdef{Conditional Constructs-pg}{10}
@xrdef{Conditional Constructs-pg}{11}
@xrdef{Command Grouping-title}{Grouping Commands}
@xrdef{Command Grouping-snt}{Section@tie 3.2.4.3}
@xrdef{Command Grouping-pg}{14}
@@ -69,7 +69,7 @@
@xrdef{GNU Parallel-title}{GNU Parallel}
@xrdef{GNU Parallel-snt}{Section@tie 3.2.6}
@xrdef{Coprocesses-pg}{15}
@xrdef{GNU Parallel-pg}{15}
@xrdef{GNU Parallel-pg}{16}
@xrdef{Shell Functions-title}{Shell Functions}
@xrdef{Shell Functions-snt}{Section@tie 3.3}
@xrdef{Shell Functions-pg}{17}
@@ -78,12 +78,12 @@
@xrdef{Shell Parameters-pg}{19}
@xrdef{Positional Parameters-title}{Positional Parameters}
@xrdef{Positional Parameters-snt}{Section@tie 3.4.1}
@xrdef{Positional Parameters-pg}{20}
@xrdef{Special Parameters-title}{Special Parameters}
@xrdef{Special Parameters-snt}{Section@tie 3.4.2}
@xrdef{Positional Parameters-pg}{20}
@xrdef{Special Parameters-pg}{21}
@xrdef{Shell Expansions-title}{Shell Expansions}
@xrdef{Shell Expansions-snt}{Section@tie 3.5}
@xrdef{Special Parameters-pg}{21}
@xrdef{Brace Expansion-title}{Brace Expansion}
@xrdef{Brace Expansion-snt}{Section@tie 3.5.1}
@xrdef{Shell Expansions-pg}{22}
@@ -102,11 +102,11 @@
@xrdef{Process Substitution-snt}{Section@tie 3.5.6}
@xrdef{Command Substitution-pg}{30}
@xrdef{Arithmetic Expansion-pg}{30}
@xrdef{Process Substitution-pg}{30}
@xrdef{Word Splitting-title}{Word Splitting}
@xrdef{Word Splitting-snt}{Section@tie 3.5.7}
@xrdef{Filename Expansion-title}{Filename Expansion}
@xrdef{Filename Expansion-snt}{Section@tie 3.5.8}
@xrdef{Process Substitution-pg}{31}
@xrdef{Word Splitting-pg}{31}
@xrdef{Filename Expansion-pg}{31}
@xrdef{Pattern Matching-title}{Pattern Matching}
+2 -2
View File
@@ -34,7 +34,7 @@
\entry{commands, lists}{9}{commands, lists}
\entry{commands, compound}{9}{commands, compound}
\entry{commands, looping}{10}{commands, looping}
\entry{commands, conditional}{10}{commands, conditional}
\entry{commands, conditional}{11}{commands, conditional}
\entry{commands, grouping}{14}{commands, grouping}
\entry{coprocess}{15}{coprocess}
\entry{shell function}{17}{shell function}
@@ -54,7 +54,7 @@
\entry{command substitution}{30}{command substitution}
\entry{expansion, arithmetic}{30}{expansion, arithmetic}
\entry{arithmetic expansion}{30}{arithmetic expansion}
\entry{process substitution}{30}{process substitution}
\entry{process substitution}{31}{process substitution}
\entry{word splitting}{31}{word splitting}
\entry{expansion, filename}{31}{expansion, filename}
\entry{expansion, pathname}{31}{expansion, pathname}
+2 -2
View File
@@ -20,7 +20,7 @@
\entry {command substitution}{30}
\entry {command timing}{8}
\entry {commands, compound}{9}
\entry {commands, conditional}{10}
\entry {commands, conditional}{11}
\entry {commands, grouping}{14}
\entry {commands, lists}{9}
\entry {commands, looping}{10}
@@ -99,7 +99,7 @@
\entry {POSIX Mode}{98}
\entry {process group}{3}
\entry {process group ID}{3}
\entry {process substitution}{30}
\entry {process substitution}{31}
\entry {programmable completion}{131}
\entry {prompting}{96}
\initial {Q}
BIN
View File
Binary file not shown.
+31 -10
View File
@@ -861,7 +861,7 @@ present, are decoded as follows:
</p></dd>
<dt><code>\<var>nnn</var></code></dt>
<dd><p>the eight-bit character whose value is the octal value <var>nnn</var>
(one to three digits)
(one to three octal digits)
</p></dd>
<dt><code>\x<var>HH</var></code></dt>
<dd><p>the eight-bit character whose value is the hexadecimal value <var>HH</var>
@@ -1051,8 +1051,13 @@ the time information.
<p>If the pipeline is not executed asynchronously (see <a href="#Lists">Lists</a>), the
shell waits for all commands in the pipeline to complete.
</p>
<p>Each command in a pipeline is executed in its own subshell
(see <a href="#Command-Execution-Environment">Command Execution Environment</a>). The exit
<p>Each command in a pipeline is executed in its own subshell, which is a
separate process (see <a href="#Command-Execution-Environment">Command Execution Environment</a>).
If the <code>lastpipe</code> option is enabled using the <code>shopt</code> builtin
(see <a href="#The-Shopt-Builtin">The Shopt Builtin</a>),
the last element of a pipeline may be run by the shell process.
</p>
<p>The exit
status of a pipeline is the exit status of the last command in the
pipeline, unless the <code>pipefail</code> option is enabled
(see <a href="#The-Set-Builtin">The Set Builtin</a>).
@@ -1111,7 +1116,7 @@ associativity.
</pre></div>
<p><var>command2</var> is executed if, and only if, <var>command1</var>
returns an exit status of zero.
returns an exit status of zero (success).
</p>
<p>An <small>OR</small> list has the form
</p><div class="example">
@@ -1144,7 +1149,7 @@ Next: <a href="#Coprocesses" accesskey="n" rel="next">Coprocesses</a>, Previous:
</td></tr>
</table>
<p>Compound commands are the shell programming constructs.
<p>Compound commands are the shell programming language constructs.
Each construct begins with a reserved word or control operator and is
terminated by a corresponding reserved word or operator.
Any redirections (see <a href="#Redirections">Redirections</a>) associated with a compound command
@@ -1211,13 +1216,15 @@ in <var>consequent-commands</var>, or zero if none was executed.
<pre class="example">for <var>name</var> [ [in [<var>words</var> &hellip;] ] ; ] do <var>commands</var>; done
</pre></div>
<p>Expand <var>words</var>, and execute <var>commands</var> once for each member
<p>Expand <var>words</var> (see <a href="#Shell-Expansions">Shell Expansions</a>), and execute <var>commands</var>
once for each member
in the resultant list, with <var>name</var> bound to the current member.
If &lsquo;<samp>in <var>words</var></samp>&rsquo; is not present, the <code>for</code> command
executes the <var>commands</var> once for each positional parameter that is
set, as if &lsquo;<samp>in &quot;$@&quot;</samp>&rsquo; had been specified
(see <a href="#Special-Parameters">Special Parameters</a>).
The return status is the exit status of the last command that executes.
</p>
<p>The return status is the exit status of the last command that executes.
If there are no items in the expansion of <var>words</var>, no commands are
executed, and the return status is zero.
</p>
@@ -1295,6 +1302,8 @@ zero if no condition tested true.
<p><code>case</code> will selectively execute the <var>command-list</var> corresponding to
the first <var>pattern</var> that matches <var>word</var>.
The match is performed according
to the rules described below in <a href="#Pattern-Matching">Pattern Matching</a>.
If the <code>nocasematch</code> shell option
(see the description of <code>shopt</code> in <a href="#The-Shopt-Builtin">The Shopt Builtin</a>)
is enabled, the match is performed without regard to the case
@@ -1306,7 +1315,9 @@ as a <var>clause</var>.
</p>
<p>Each clause must be terminated with &lsquo;<samp>;;</samp>&rsquo;, &lsquo;<samp>;&amp;</samp>&rsquo;, or &lsquo;<samp>;;&amp;</samp>&rsquo;.
The <var>word</var> undergoes tilde expansion, parameter expansion, command
substitution, arithmetic expansion, and quote removal before matching is
substitution, arithmetic expansion, and quote removal
(see <a href="#Shell-Parameter-Expansion">Shell Parameter Expansion</a>)
before matching is
attempted. Each <var>pattern</var> undergoes tilde expansion, parameter
expansion, command substitution, and arithmetic expansion.
</p>
@@ -1467,7 +1478,7 @@ if there is a sequence of characters in the value consisting of
any number, including zero, of
space characters, zero or one instances of &lsquo;<samp>a</samp>&rsquo;, then a &lsquo;<samp>b</samp>&rsquo;:
</p><div class="example">
<pre class="example">[[ $line =~ [[:space:]]*(a)?b ]]
<pre class="example">[[ $line =~ [[:space:]]*?(a)b ]]
</pre></div>
<p>That means values like &lsquo;<samp>aab</samp>&rsquo; and &lsquo;<samp> aaaaaab</samp>&rsquo; will match, as
@@ -1482,7 +1493,7 @@ expressions while paying attention to the shell&rsquo;s quote removal.
Using a shell variable to store the pattern decreases these problems.
For example, the following is equivalent to the above:
</p><div class="example">
<pre class="example">pattern='[[:space:]]*(a)?b'
<pre class="example">pattern='[[:space:]]*?(a)b'
[[ $line =~ $pattern ]]
</pre></div>
@@ -1915,6 +1926,15 @@ var=global
func1
</pre></div>
<p>The <code>unset</code> builtin also acts using the same dynamic scope: if a
variable is local to the current scope, <code>unset</code> will unset it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the local scope is unset, it will remain so
until it is reset in that scope or until the function returns.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
</p>
<p>Function names and definitions may be listed with the
<samp>-f</samp> option to the <code>declare</code> (<code>typeset</code>)
builtin command (see <a href="#Bash-Builtins">Bash Builtins</a>).
@@ -8508,6 +8528,7 @@ destroys the array element at index <var>subscript</var>.
Negative subscripts to indexed arrays are interpreted as described above.
Care must be taken to avoid unwanted side effects caused by filename
expansion.
Unsetting the last element of an array variable does not unset the variable.
<code>unset <var>name</var></code>, where <var>name</var> is an array, removes the
entire array. A subscript of &lsquo;<samp>*</samp>&rsquo; or &lsquo;<samp>@</samp>&rsquo; also removes the
entire array.
+125 -121
View File
@@ -586,16 +586,20 @@ information.
If the pipeline is not executed asynchronously (*note Lists::), the
shell waits for all commands in the pipeline to complete.
Each command in a pipeline is executed in its own subshell (*note
Command Execution Environment::). The exit status of a pipeline is the
exit status of the last command in the pipeline, unless the 'pipefail'
option is enabled (*note The Set Builtin::). If 'pipefail' is enabled,
the pipeline's return status is the value of the last (rightmost)
command to exit with a non-zero status, or zero if all commands exit
successfully. If the reserved word '!' precedes the pipeline, the exit
status is the logical negation of the exit status as described above.
The shell waits for all commands in the pipeline to terminate before
returning a value.
Each command in a pipeline is executed in its own subshell, which is
a separate process (*note Command Execution Environment::). If the
'lastpipe' option is enabled using the 'shopt' builtin (*note The Shopt
Builtin::), the last element of a pipeline may be run by the shell
process.
The exit status of a pipeline is the exit status of the last command
in the pipeline, unless the 'pipefail' option is enabled (*note The Set
Builtin::). If 'pipefail' is enabled, the pipeline's return status is
the value of the last (rightmost) command to exit with a non-zero
status, or zero if all commands exit successfully. If the reserved word
'!' precedes the pipeline, the exit status is the logical negation of
the exit status as described above. The shell waits for all commands in
the pipeline to terminate before returning a value.

File: bashref.info, Node: Lists, Next: Compound Commands, Prev: Pipelines, Up: Shell Commands
@@ -11504,116 +11508,116 @@ Node: Comments18728
Node: Shell Commands19346
Node: Simple Commands20218
Node: Pipelines20849
Node: Lists23592
Node: Compound Commands25331
Node: Looping Constructs26343
Node: Conditional Constructs28838
Node: Command Grouping39893
Node: Coprocesses41372
Node: GNU Parallel43204
Node: Shell Functions47177
Node: Shell Parameters54376
Node: Positional Parameters58789
Node: Special Parameters59689
Node: Shell Expansions63026
Node: Brace Expansion65120
Node: Tilde Expansion67954
Node: Shell Parameter Expansion70302
Node: Command Substitution84434
Node: Arithmetic Expansion85789
Node: Process Substitution86721
Node: Word Splitting87841
Node: Filename Expansion89785
Node: Pattern Matching92159
Node: Quote Removal96145
Node: Redirections96440
Node: Executing Commands105998
Node: Simple Command Expansion106668
Node: Command Search and Execution108598
Node: Command Execution Environment110934
Node: Environment113918
Node: Exit Status115577
Node: Signals117247
Node: Shell Scripts119214
Node: Shell Builtin Commands121729
Node: Bourne Shell Builtins123763
Node: Bash Builtins144363
Node: Modifying Shell Behavior173008
Node: The Set Builtin173353
Node: The Shopt Builtin183766
Node: Special Builtins199664
Node: Shell Variables200643
Node: Bourne Shell Variables201080
Node: Bash Variables203184
Node: Bash Features232977
Node: Invoking Bash233876
Node: Bash Startup Files239825
Node: Interactive Shells244928
Node: What is an Interactive Shell?245338
Node: Is this Shell Interactive?245987
Node: Interactive Shell Behavior246802
Node: Bash Conditional Expressions250290
Node: Shell Arithmetic254656
Node: Aliases257473
Node: Arrays260021
Node: The Directory Stack265183
Node: Directory Stack Builtins265967
Node: Controlling the Prompt268935
Node: The Restricted Shell271697
Node: Bash POSIX Mode273522
Node: Job Control283873
Node: Job Control Basics284333
Node: Job Control Builtins289301
Node: Job Control Variables294028
Node: Command Line Editing295184
Node: Introduction and Notation296855
Node: Readline Interaction298478
Node: Readline Bare Essentials299669
Node: Readline Movement Commands301452
Node: Readline Killing Commands302412
Node: Readline Arguments304330
Node: Searching305374
Node: Readline Init File307560
Node: Readline Init File Syntax308707
Node: Conditional Init Constructs328894
Node: Sample Init File331419
Node: Bindable Readline Commands334536
Node: Commands For Moving335740
Node: Commands For History337589
Node: Commands For Text341884
Node: Commands For Killing345273
Node: Numeric Arguments347754
Node: Commands For Completion348893
Node: Keyboard Macros353084
Node: Miscellaneous Commands353771
Node: Readline vi Mode359647
Node: Programmable Completion360554
Node: Programmable Completion Builtins368015
Node: A Programmable Completion Example377901
Node: Using History Interactively383153
Node: Bash History Facilities383837
Node: Bash History Builtins386838
Node: History Interaction391130
Node: Event Designators394094
Node: Word Designators395313
Node: Modifiers396950
Node: Installing Bash398352
Node: Basic Installation399489
Node: Compilers and Options402180
Node: Compiling For Multiple Architectures402921
Node: Installation Names404584
Node: Specifying the System Type405402
Node: Sharing Defaults406118
Node: Operation Controls406791
Node: Optional Features407749
Node: Reporting Bugs418275
Node: Major Differences From The Bourne Shell419469
Node: GNU Free Documentation License436321
Node: Indexes461498
Node: Builtin Index461952
Node: Reserved Word Index468779
Node: Variable Index471227
Node: Function Index486905
Node: Concept Index500208
Node: Lists23781
Node: Compound Commands25520
Node: Looping Constructs26532
Node: Conditional Constructs29027
Node: Command Grouping40082
Node: Coprocesses41561
Node: GNU Parallel43393
Node: Shell Functions47366
Node: Shell Parameters54565
Node: Positional Parameters58978
Node: Special Parameters59878
Node: Shell Expansions63215
Node: Brace Expansion65309
Node: Tilde Expansion68143
Node: Shell Parameter Expansion70491
Node: Command Substitution84623
Node: Arithmetic Expansion85978
Node: Process Substitution86910
Node: Word Splitting88030
Node: Filename Expansion89974
Node: Pattern Matching92348
Node: Quote Removal96334
Node: Redirections96629
Node: Executing Commands106187
Node: Simple Command Expansion106857
Node: Command Search and Execution108787
Node: Command Execution Environment111123
Node: Environment114107
Node: Exit Status115766
Node: Signals117436
Node: Shell Scripts119403
Node: Shell Builtin Commands121918
Node: Bourne Shell Builtins123952
Node: Bash Builtins144552
Node: Modifying Shell Behavior173197
Node: The Set Builtin173542
Node: The Shopt Builtin183955
Node: Special Builtins199853
Node: Shell Variables200832
Node: Bourne Shell Variables201269
Node: Bash Variables203373
Node: Bash Features233166
Node: Invoking Bash234065
Node: Bash Startup Files240014
Node: Interactive Shells245117
Node: What is an Interactive Shell?245527
Node: Is this Shell Interactive?246176
Node: Interactive Shell Behavior246991
Node: Bash Conditional Expressions250479
Node: Shell Arithmetic254845
Node: Aliases257662
Node: Arrays260210
Node: The Directory Stack265372
Node: Directory Stack Builtins266156
Node: Controlling the Prompt269124
Node: The Restricted Shell271886
Node: Bash POSIX Mode273711
Node: Job Control284062
Node: Job Control Basics284522
Node: Job Control Builtins289490
Node: Job Control Variables294217
Node: Command Line Editing295373
Node: Introduction and Notation297044
Node: Readline Interaction298667
Node: Readline Bare Essentials299858
Node: Readline Movement Commands301641
Node: Readline Killing Commands302601
Node: Readline Arguments304519
Node: Searching305563
Node: Readline Init File307749
Node: Readline Init File Syntax308896
Node: Conditional Init Constructs329083
Node: Sample Init File331608
Node: Bindable Readline Commands334725
Node: Commands For Moving335929
Node: Commands For History337778
Node: Commands For Text342073
Node: Commands For Killing345462
Node: Numeric Arguments347943
Node: Commands For Completion349082
Node: Keyboard Macros353273
Node: Miscellaneous Commands353960
Node: Readline vi Mode359836
Node: Programmable Completion360743
Node: Programmable Completion Builtins368204
Node: A Programmable Completion Example378090
Node: Using History Interactively383342
Node: Bash History Facilities384026
Node: Bash History Builtins387027
Node: History Interaction391319
Node: Event Designators394283
Node: Word Designators395502
Node: Modifiers397139
Node: Installing Bash398541
Node: Basic Installation399678
Node: Compilers and Options402369
Node: Compiling For Multiple Architectures403110
Node: Installation Names404773
Node: Specifying the System Type405591
Node: Sharing Defaults406307
Node: Operation Controls406980
Node: Optional Features407938
Node: Reporting Bugs418464
Node: Major Differences From The Bourne Shell419658
Node: GNU Free Documentation License436510
Node: Indexes461687
Node: Builtin Index462141
Node: Reserved Word Index468968
Node: Variable Index471416
Node: Function Index487094
Node: Concept Index500397

End Tag Table
+16 -16
View File
@@ -1,4 +1,4 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/MacPorts 2016_4) (preloaded format=pdfetex 2017.1.6) 28 MAR 2017 14:25
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/MacPorts 2016_4) (preloaded format=pdfetex 2017.1.6) 3 APR 2017 16:34
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
@@ -185,7 +185,7 @@ p/pdftex/updmap/pdftex.map}] [2] (/Users/chet/src/bash/src/doc/bashref.toc
\openout4 = `bashref.rw'.
[8] [9] [10]
Overfull \hbox (38.26587pt too wide) in paragraph at lines 874--874
Overfull \hbox (38.26587pt too wide) in paragraph at lines 879--879
[]@texttt case @textttsl word @texttt in [ [(] @textttsl pat-tern @texttt [| @
textttsl pattern@texttt ][]) @textttsl command-list @texttt ;;][] esac[]
@@ -198,7 +198,7 @@ textttsl pattern@texttt ][]) @textttsl command-list @texttt ;;][] esac[]
.etc.
[11] [12] [13] [14] [15]
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1280--1280
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1285--1285
[]@texttt cat list | parallel "do-something1 {} config-{} ; do-something2 < {}
" | process-output[]
@@ -210,8 +210,8 @@ Overfull \hbox (89.6747pt too wide) in paragraph at lines 1280--1280
.@texttt t
.etc.
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1303--1303
[16]
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1308--1308
[]@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p
arallel traceroute[]
@@ -223,8 +223,8 @@ arallel traceroute[]
.@glue 5.74869
.etc.
[16]
Overfull \hbox (106.92076pt too wide) in paragraph at lines 1309--1309
Overfull \hbox (106.92076pt too wide) in paragraph at lines 1314--1314
[]@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p
arallel -k traceroute[]
@@ -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 4343--4343
Overfull \hbox (26.76846pt too wide) in paragraph at lines 4348--4348
[]@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 4547--4547
Overfull \hbox (38.26584pt too wide) in paragraph at lines 4552--4552
[]@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 4547--4547
[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 6294--6294
Overfull \hbox (49.43388pt too wide) in paragraph at lines 6299--6299
[]@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 6295--6295
Overfull \hbox (72.42863pt too wide) in paragraph at lines 6300--6300
[]@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 6295--6295
.etc.
Overfull \hbox (32.18782pt too wide) in paragraph at lines 6296--6296
Overfull \hbox (32.18782pt too wide) in paragraph at lines 6301--6301
[]@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 497105
47069 string characters out of 6206776
136585 words of memory out of 5000000
136513 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, 742807 bytes).
Output written on bashref.pdf (182 pages, 742837 bytes).
PDF statistics:
2607 PDF objects out of 2984 (max. 8388607)
2380 compressed objects within 24 object streams
2606 PDF objects out of 2984 (max. 8388607)
2379 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.
+3229 -3202
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -5,11 +5,11 @@
\entry{done}{10}{\code {done}}
\entry{while}{10}{\code {while}}
\entry{for}{10}{\code {for}}
\entry{if}{10}{\code {if}}
\entry{then}{10}{\code {then}}
\entry{else}{10}{\code {else}}
\entry{elif}{10}{\code {elif}}
\entry{fi}{10}{\code {fi}}
\entry{if}{11}{\code {if}}
\entry{then}{11}{\code {then}}
\entry{else}{11}{\code {else}}
\entry{elif}{11}{\code {elif}}
\entry{fi}{11}{\code {fi}}
\entry{case}{11}{\code {case}}
\entry{in}{11}{\code {in}}
\entry{esac}{11}{\code {esac}}
+5 -5
View File
@@ -14,20 +14,20 @@
\entry {\code {do}}{10}
\entry {\code {done}}{10}
\initial {E}
\entry {\code {elif}}{10}
\entry {\code {else}}{10}
\entry {\code {elif}}{11}
\entry {\code {else}}{11}
\entry {\code {esac}}{11}
\initial {F}
\entry {\code {fi}}{10}
\entry {\code {fi}}{11}
\entry {\code {for}}{10}
\entry {\code {function}}{17}
\initial {I}
\entry {\code {if}}{10}
\entry {\code {if}}{11}
\entry {\code {in}}{11}
\initial {S}
\entry {\code {select}}{12}
\initial {T}
\entry {\code {then}}{10}
\entry {\code {then}}{11}
\entry {\code {time}}{8}
\initial {U}
\entry {\code {until}}{10}
+2
View File
@@ -4360,6 +4360,8 @@ Options, if supplied, have the following meanings:
@item -d
The first character of @var{delim} is used to terminate each input line,
rather than newline.
If @var{delim} is the empty string, @code{read} will terminate a line
when it reads a NUL character.
@item -n
Copy at most @var{count} lines. If @var{count} is 0, all lines are copied.
@item -O
+4 -4
View File
@@ -18,10 +18,10 @@
@numsubsecentry{Lists of Commands}{3.2.3}{Lists}{9}
@numsubsecentry{Compound Commands}{3.2.4}{Compound Commands}{9}
@numsubsubsecentry{Looping Constructs}{3.2.4.1}{Looping Constructs}{10}
@numsubsubsecentry{Conditional Constructs}{3.2.4.2}{Conditional Constructs}{10}
@numsubsubsecentry{Conditional Constructs}{3.2.4.2}{Conditional Constructs}{11}
@numsubsubsecentry{Grouping Commands}{3.2.4.3}{Command Grouping}{14}
@numsubsecentry{Coprocesses}{3.2.5}{Coprocesses}{15}
@numsubsecentry{GNU Parallel}{3.2.6}{GNU Parallel}{15}
@numsubsecentry{GNU Parallel}{3.2.6}{GNU Parallel}{16}
@numsecentry{Shell Functions}{3.3}{Shell Functions}{17}
@numsecentry{Shell Parameters}{3.4}{Shell Parameters}{19}
@numsubsecentry{Positional Parameters}{3.4.1}{Positional Parameters}{20}
@@ -32,7 +32,7 @@
@numsubsecentry{Shell Parameter Expansion}{3.5.3}{Shell Parameter Expansion}{24}
@numsubsecentry{Command Substitution}{3.5.4}{Command Substitution}{30}
@numsubsecentry{Arithmetic Expansion}{3.5.5}{Arithmetic Expansion}{30}
@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{30}
@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{31}
@numsubsecentry{Word Splitting}{3.5.7}{Word Splitting}{31}
@numsubsecentry{Filename Expansion}{3.5.8}{Filename Expansion}{31}
@numsubsubsecentry{Pattern Matching}{3.5.8.1}{Pattern Matching}{32}
@@ -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
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Wed Mar 22 16:11:15 2017
%%CreationDate: Mon Apr 3 16:33:54 2017
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Wed Mar 22 16:11:15 2017
%%CreationDate: Mon Apr 3 16:33:54 2017
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 3
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2017 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Wed Mar 22 16:10:53 EDT 2017
@set LASTCHANGE Tue Apr 4 14:56:04 EDT 2017
@set EDITION 4.4
@set VERSION 4.4
@set UPDATED 22 March 2017
@set UPDATED-MONTH March 2017
@set UPDATED 4 April 2017
@set UPDATED-MONTH April 2017
+18 -2
View File
@@ -3389,7 +3389,7 @@ execute_case_command (case_command)
WORD_LIST *wlist, *es;
PATTERN_LIST *clauses;
char *word, *pattern;
int retval, match, ignore_return, save_line_number;
int retval, match, ignore_return, save_line_number, qflags;
save_line_number = line_number;
line_number = case_command->line;
@@ -3441,7 +3441,15 @@ execute_case_command (case_command)
es = expand_word_leave_quoted (list->word, 0);
if (es && es->word && es->word->word && *(es->word->word))
pattern = quote_string_for_globbing (es->word->word, QGLOB_CVTNULL);
{
qflags = QGLOB_CVTNULL;
/* We left CTLESC in place quoting CTLESC after the call to
expand_word_leave_quoted; tell quote_string_for_globbing to
remove those here */
if ((list->word->flags & W_QUOTED) == 0)
qflags |= QGLOB_CTLESC;
pattern = quote_string_for_globbing (es->word->word, qflags);
}
else
{
pattern = (char *)xmalloc (1);
@@ -5689,6 +5697,7 @@ execute_intern_function (name, funcdef)
FUNCTION_DEF *funcdef;
{
SHELL_VAR *var;
char *t;
if (check_identifier (name, posixly_correct) == 0)
{
@@ -5700,6 +5709,13 @@ execute_intern_function (name, funcdef)
return (EXECUTION_FAILURE);
}
if (strchr (name->word, CTLESC)) /* WHY? */
{
t = dequote_escapes (name->word);
free (name->word);
name->word = t;
}
/* Posix interpretation 383 */
if (posixly_correct && find_special_builtin (name->word))
{
+5 -1
View File
@@ -205,7 +205,7 @@ quote_string_for_globbing (pathname, qflags)
}
/* If we are parsing regexp, turn CTLESC CTLESC into CTLESC. It's not an
ERE special character, so we should just be able to pass it through. */
else if ((qflags & QGLOB_REGEXP) && pathname[i] == CTLESC && pathname[i+1] == CTLESC)
else if ((qflags & (QGLOB_REGEXP|QGLOB_CTLESC)) && pathname[i] == CTLESC && pathname[i+1] == CTLESC)
{
i++;
temp[j++] = pathname[i];
@@ -325,6 +325,10 @@ quote_string_for_globbing (pathname, qflags)
i++;
if (pathname[i] == '\0')
break;
/* If we are turning CTLESC CTLESC into CTLESC, we need to do that
even when the first CTLESC is preceded by a backslash. */
if ((qflags & QGLOB_CTLESC) && pathname[i] == CTLESC && pathname[i+1] == CTLESC)
i++; /* skip over one of the CTLESCs */
}
else if (pathname[i] == '\\' && (qflags & QGLOB_REGEXP))
last_was_backslash = 1;
+1
View File
@@ -33,6 +33,7 @@ extern char *glob_error_return;
#define QGLOB_CVTNULL 0x01 /* convert QUOTED_NULL strings to '\0' */
#define QGLOB_FILENAME 0x02 /* do correct quoting for matching filenames */
#define QGLOB_REGEXP 0x04 /* quote an ERE for regcomp/regexec */
#define QGLOB_CTLESC 0x08 /* turn CTLESC CTLESC into CTLESC for BREs */
#if defined (EXTENDED_GLOB)
/* Flags to OR with other flag args to strmatch() to enabled the extended
+90 -31
View File
@@ -3942,11 +3942,7 @@ expand_word_unsplit (word, quoted)
WORD_LIST *result;
expand_no_split_dollar_star = 1;
#if defined (HANDLE_MULTIBYTE)
if (ifs_firstc[0] == 0)
#else
if (ifs_firstc == 0)
#endif
if (ifs_is_null)
word->flags |= W_NOSPLIT;
word->flags |= W_NOSPLIT2;
result = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL);
@@ -3966,11 +3962,7 @@ expand_word_leave_quoted (word, quoted)
WORD_LIST *result;
expand_no_split_dollar_star = 1;
#if defined (HANDLE_MULTIBYTE)
if (ifs_firstc[0] == 0)
#else
if (ifs_firstc == 0)
#endif
if (ifs_is_null)
word->flags |= W_NOSPLIT;
word->flags |= W_NOSPLIT2;
result = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL);
@@ -4002,11 +3994,11 @@ expand_word_leave_quoted (word, quoted)
document (effectively double-quoted). */
char *
quote_escapes (string)
char *string;
const char *string;
{
register char *s, *t;
const char *s, *send;
char *t, *result;
size_t slen;
char *result, *send;
int quote_spaces, skip_ctlesc, skip_ctlnul;
DECLARE_MBSTATE;
@@ -4061,16 +4053,16 @@ list_quote_escapes (list)
Also used by parts of the pattern substitution code. */
char *
dequote_escapes (string)
char *string;
const char *string;
{
register char *s, *t, *s1;
const char *s, *send;
char *t, *result;
size_t slen;
char *result, *send;
int quote_spaces;
DECLARE_MBSTATE;
if (string == 0)
return string;
return (char *)0;
slen = strlen (string);
send = string + slen;
@@ -6390,6 +6382,7 @@ parameter_brace_expand_word (name, var_is_special, quoted, pflags, indp)
{
expand_arrayref:
var = array_variable_part (name, 0, &tt, (int *)0);
/* These are the cases where word splitting will not be performed */
if (pflags & PF_ASSIGNRHS)
{
if (ALL_ELEMENT_SUB (tt[0]) && tt[1] == RBRACK)
@@ -6404,6 +6397,25 @@ expand_arrayref:
else
temp = array_value (name, quoted, 0, &atype, &ind);
}
/* Posix interp 888 */
else if (pflags & PF_NOSPLIT2)
{
/* Special cases, then general case, for each of A[@], A[*], A[n] */
#if defined (HANDLE_MULTIBYTE)
if (tt[0] == '@' && tt[1] == RBRACK && var && quoted == 0 && ifs_is_set && ifs_is_null == 0 && ifs_firstc[0] != ' ')
#else
if (tt[0] == '@' && tt[1] == RBRACK && var && quoted == 0 && ifs_is_set && ifs_is_null == 0 && ifs_firstc != ' ')
#endif
temp = array_value (name, Q_DOUBLE_QUOTES, AV_ASSIGNRHS, &atype, &ind);
else if (tt[0] == '@' && tt[1] == RBRACK)
temp = array_value (name, quoted, 0, &atype, &ind);
else if (tt[0] == '*' && tt[1] == RBRACK && expand_no_split_dollar_star && ifs_is_null)
temp = array_value (name, Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT, 0, &atype, &ind);
else if (tt[0] == '*' && tt[1] == RBRACK)
temp = array_value (name, quoted, 0, &atype, &ind);
else
temp = array_value (name, quoted, 0, &atype, &ind);
}
else if (tt[0] == '*' && tt[1] == RBRACK && expand_no_split_dollar_star && ifs_is_null)
temp = array_value (name, Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT, 0, &atype, &ind);
else
@@ -7235,7 +7247,7 @@ string_transform (xc, v, s)
SHELL_VAR *v;
char *s;
{
char *ret, flags[MAX_ATTRIBUTES];
char *ret, flags[MAX_ATTRIBUTES], *t;
int i;
if (((xc == 'A' || xc == 'a') && v == 0) || (xc != 'a' && s == 0))
@@ -7253,7 +7265,9 @@ string_transform (xc, v, s)
break;
/* Transformations that modify the variable's value */
case 'E':
ret = ansiexpand (s, 0, strlen (s), (int *)0);
t = ansiexpand (s, 0, strlen (s), (int *)0);
ret = dequote_escapes (t);
free (t);
break;
case 'P':
ret = decode_prompt_string (s);
@@ -7278,6 +7292,7 @@ list_transform (xc, v, list, itype, quoted)
WORD_LIST *new, *l;
WORD_DESC *w;
char *tword;
int qflags;
for (new = (WORD_LIST *)NULL, l = list; l; l = l->next)
{
@@ -7286,9 +7301,15 @@ list_transform (xc, v, list, itype, quoted)
w->word = tword ? tword : savestring (""); /* XXX */
new = make_word_list (w, new);
}
l = REVERSE_LIST (new, WORD_LIST *);
tword = string_list_pos_params (itype, l, quoted);
qflags = quoted;
/* If we are expanding in a context where word splitting will not be
performed, treat as quoted. This changes how $* will be expanded. */
if (xc != 'Q' && itype == '*' && expand_no_split_dollar_star && ifs_is_null)
qflags |= Q_DOUBLE_QUOTES; /* Posix interp 888 */
tword = string_list_pos_params (itype, l, qflags);
dispose_words (l);
return (tword);
@@ -7412,7 +7433,11 @@ parameter_brace_transform (varname, value, ind, xform, rtype, quoted, pflags, fl
#if defined (ARRAY_VARS)
case VT_ARRAYVAR:
temp1 = array_transform (xc, v, varname, quoted);
if (temp1 && ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0))
if (temp1 && quoted == 0 && ifs_is_null)
{
/* Posix interp 888 */
}
else if (temp1 && ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0))
{
val = quote_escapes (temp1);
free (temp1);
@@ -7538,11 +7563,10 @@ parameter_brace_substring (varname, value, ind, substr, quoted, pflags, flags)
break;
case VT_POSPARMS:
qflags = quoted;
if (expand_no_split_dollar_star && starsub && (pflags & PF_NOSPLIT2))
qflags |= Q_DOUBLE_QUOTES; /* Posix interp 888 */
if (starsub && (pflags & PF_ASSIGNRHS) && quoted == 0 && ifs_is_null)
qflags |= Q_DOUBLE_QUOTES; /* Posix interp 888 */
tt = pos_params (varname, e1, e2, qflags);
/* string_list_dollar_at will quote the list if ifs_is_null != 0 */
/* We want to leave this alone in every case where pos_params/
string_list_pos_params quotes the list members */
if (tt && quoted == 0 && ifs_is_null)
{
temp = tt; /* Posix interp 888 */
@@ -7762,7 +7786,7 @@ pos_params_pat_subst (string, pat, rep, mflags)
/* If we are expanding in a context where word splitting will not be
performed, treat as quoted. This changes how $* will be expanded. */
if (pchar == '*' && (mflags & MATCH_ASSIGNRHS) && ifs_is_null)
if (pchar == '*' && (mflags & MATCH_ASSIGNRHS) && expand_no_split_dollar_star && ifs_is_null)
qflags |= Q_DOUBLE_QUOTES; /* Posix interp 888 */
ret = string_list_pos_params (pchar, save, qflags);
@@ -9024,10 +9048,32 @@ param_expand (string, sindex, quoted, expanded_something,
parameters no matter what IFS is set to. */
/* XXX - what to do when in a context where word splitting is not
performed? Even when IFS is not the default, posix seems to imply
that we behave like unquoted $* ? Maybe we should use PF_NOSPLIT2
here. */
/* XXX - bash-4.4/bash-5.0 passing PFLAGS */
temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted, pflags);
that we behave like unquoted $* ? See below for how we use
PF_NOSPLIT2 here. */
/* These are the cases where word splitting will not be performed. */
if (pflags & PF_ASSIGNRHS)
temp = string_list_dollar_at (list, (quoted|Q_DOUBLE_QUOTES), pflags);
/* This needs to match what expand_word_internal does with non-quoted $@
does with separating with spaces. Passing Q_DOUBLE_QUOTES means that
the characters in LIST will be quoted, and PF_ASSIGNRHS ensures that
they will separated by spaces. After doing this, we need the special
handling for PF_NOSPLIT2 in expand_word_internal to remove the CTLESC
quotes. */
else if (pflags & PF_NOSPLIT2)
{
#if defined (HANDLE_MULTIBYTE)
if (quoted == 0 && ifs_is_set && ifs_is_null == 0 && ifs_firstc[0] != ' ')
#else
if (quoted == 0 && ifs_is_set && ifs_is_null == 0 && ifs_firstc != ' ')
#endif
/* Posix interp 888 */
temp = string_list_dollar_at (list, Q_DOUBLE_QUOTES, pflags);
else
temp = string_list_dollar_at (list, quoted, pflags);
}
else
temp = string_list_dollar_at (list, quoted, pflags);
tflag |= W_DOLLARAT;
dispose_words (list);
@@ -9988,6 +10034,8 @@ add_twochars:
else
{
#if HANDLE_MULTIBYTE
/* XXX - should make sure that c is actually multibyte,
otherwise we can use the twochars branch */
if (mb_cur_max > 1)
sindex--;
@@ -10125,7 +10173,18 @@ finished_with_string:
/* Only split and rejoin if we have to */
if (*ifs_chars && *ifs_chars != ' ')
{
/* list_string dequotes CTLESCs in the string it's passed, so we
need it to get the space separation right if space isn't the
first character in IFS (but is present) and to remove the
quoting we added back in param_expand(). */
list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1);
/* This isn't exactly right in the case where we're expanding
the RHS of an expansion like ${var-$@} where IFS=: (for
example). The W_NOSPLIT2 means we do the separation with :;
the list_string removes the quotes and breaks the string into
a list, and the string_list rejoins it on spaces. When we
return, we expect to be able to split the results, but the
space separation means the right split doesn't happen. */
tword->word = string_list (list);
}
else
+2 -2
View File
@@ -192,7 +192,7 @@ extern char *expand_arith_string __P((char *, int));
extern char *dequote_string __P((char *));
/* De-quote CTLESC-escaped CTLESC or CTLNUL characters in STRING. */
extern char *dequote_escapes __P((char *));
extern char *dequote_escapes __P((const char *));
/* De-quote quoted characters in each word in LIST. */
extern WORD_LIST *dequote_list __P((WORD_LIST *));
@@ -216,7 +216,7 @@ extern char *quote_string __P((char *));
/* Quote escape characters (characters special to interals of expansion)
in a string. */
extern char *quote_escapes __P((char *));
extern char *quote_escapes __P((const char *));
/* And remove such quoted special characters. */
extern char *remove_quoted_escapes __P((char *));
+11
View File
@@ -25,3 +25,14 @@ ok 8
ok 9
mysterious 1
mysterious 2
argv[1] = <\a\b\c\^A\d\e\f>
argv[1] = <\a\b\c\^A\d\e\f>
argv[1] = <abc^Adef>
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
+1
View File
@@ -51,3 +51,4 @@ case " " in ( [" "] ) echo ok;; ( * ) echo no;; esac
# tests of quote removal and pattern matching
${THIS_SH} ./case1.sub
${THIS_SH} ./case2.sub
+52
View File
@@ -0,0 +1,52 @@
x=$'\\a\\b\\c\\\001\\d\\e\\f'
y='\a\b\c\\d\e\f'
z=$'abc\001def'
recho "$x"
recho "$y"
recho "$z"
case $'abc\001def' in
$x) echo ok 1 ;;
*) echo oops 1;;
esac
case $z in
$x) echo ok 2 ;;
*) echo oops 2;;
esac
case $'abc\001def' in
$y) echo ok 3 ;;
*) echo oops 3;;
esac
case $z in
$y) echo ok 4 ;;
*) echo oops 4;;
esac
# no backslash before \001
x=$'\\a\\b\\c\001\\d\\e\\f'
y='\a\b\c\d\e\f'
case $'abc\001def' in
$x) echo ok 5 ;;
*) echo oops 5;;
esac
case $z in
$x) echo ok 6 ;;
*) echo oops 6;;
esac
case $'abc\001def' in
$y) echo ok 7 ;;
*) echo oops 7;;
esac
case $z in
$y) echo ok 8 ;;
*) echo oops 8;;
esac
+43
View File
@@ -210,11 +210,13 @@ argv[1] = <correct>
argv[2] = <a>
argv[1] = <correct>
argv[2] = <a>
./exp7.sub: line 5: INFORM: dequote_string: string with bare CTLESC
argv[1] = <^A>
argv[1] = <3>
argv[2] = <^C>
argv[3] = <^C>
argv[4] = <^C>
./exp7.sub: line 10: INFORM: dequote_string: string with bare CTLESC
argv[1] = <^A>
argv[1] = <x^Ay^?z>
argv[1] = <x^Ay^?z>
@@ -345,3 +347,44 @@ jkl
< A >< B >< a >< b >
< A >< B >< A >< B >
< A >< B ><' A '><' B '>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <a b>
argv[1] = <a>
argv[2] = <b>
argv[1] = <a b>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <12>
argv[1] = <12>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = < >
argv[1] = < >
argv[1] = < >
argv[1] = < >
argv[1] = < >
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
+1
View File
@@ -406,3 +406,4 @@ ${THIS_SH} ./exp7.sub
${THIS_SH} ./exp8.sub
${THIS_SH} ./exp9.sub
${THIS_SH} ./exp10.sub
${THIS_SH} ./exp11.sub
+92
View File
@@ -0,0 +1,92 @@
set -- '1 2'
unset var
recho ${var-${*:1}}
unset var
recho ${var=$*}
unset var
recho ${var=${*:1}}
recho "$var"
# posix interp 221
unset var
recho ${var:-a\ b}
recho ${var:=a\ b}
recho "$var"
set -- 1 2
IFS=
unset a b c
recho $*
recho ${a-$*}
recho ${b-${*/}}
recho ${c=${*/}}
recho "$c"
recho ${b-${*,,}}
recho ${d-${*,,}}
unset -v a b c
IFS=$' \t\n'
set -- ' '
A=(' ')
IFS=
unset var
var=${*@E}
recho "$var"
unset var
var=${A[*]@E}
recho "$var"
unset var
var=${@@E}
recho "$var"
unset var
var=${A[@]@E}
recho "$var"
unset novar
recho ${novar-${A[*]@E}}
unset -v var novar
IFS=$' \t\n'
set -- 1 2
A=( 1 2 )
IFS=
a=$*
recho "$a"
b=${*@E}
recho "$b"
unset a b
a=${A[*]}
recho "$a"
b=${A[*]@E}
recho "$b"
set -- $'\t'
A=$1
IFS=$1
[[ ${A[@]} ]] && echo ok 1
[[ ${A[*]} ]] && echo ok 2
[[ ${A[0]} ]] && echo ok 3
IFS=$' \t\n'
[[ ${A[@]} ]] && echo ok 4
[[ ${A[*]} ]] && echo ok 5
[[ ${A[0]} ]] && echo ok 6
IFS=
[[ ${A[@]} ]] && echo ok 7
[[ ${A[*]} ]] && echo ok 8
[[ ${A[0]} ]] && echo ok 9
+71 -2
View File
@@ -37,5 +37,74 @@ argv[1] = <'bar>
argv[1] = <foo 'bar baz>
argv[1] = <}z>
argv[1] = <''z}>
./posixexp.tests: line 77: unexpected EOF while looking for matching `}'
./posixexp.tests: line 78: syntax error: unexpected end of file
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <12>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <1>
argv[2] = <2>
argv[1] = <1 2>
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
argv[1] = <12>
normal IFS
argv[1] = <abc>
argv[2] = <def>
argv[3] = <ghi>
argv[4] = <jkl>
argv[1] = <abc>
argv[2] = <def>
argv[3] = <ghi>
argv[4] = <jkl>
argv[1] = <abc>
argv[2] = <def>
argv[3] = <ghi>
argv[4] = <jkl>
null IFS
argv[1] = < abc>
argv[2] = <def ghi>
argv[3] = <jkl >
argv[1] = < abc def ghi jkl >
argv[1] = < abc>
argv[2] = <def ghi>
argv[3] = <jkl >
non-standard IFS
argv[1] = < abc>
argv[2] = <def ghi>
argv[3] = <jkl >
argv[1] = < abc def ghi jkl >
argv[1] = < abc def ghi jkl >
unset IFS
argv[1] = < abc>
argv[2] = <def ghi>
argv[3] = <jkl >
argv[1] = < abc def ghi jkl >
argv[1] = < abc def ghi jkl >
./posixexp.tests: line 80: unexpected EOF while looking for matching `}'
./posixexp.tests: line 81: syntax error: unexpected end of file
+3
View File
@@ -72,6 +72,9 @@ ${THIS_SH} ./posixexp1.sub || echo "bash posixexp1.sub: test $? failed"
THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp2.sub || echo "sh posixexp2.sub: test $? failed"
rm -f $TMPDIR/sh
${THIS_SH} ./posixexp3.sub
${THIS_SH} ./posixexp4.sub
# this will be an error
foo=bar
echo "${foo:-"a}"
+35
View File
@@ -0,0 +1,35 @@
set -- 1 2
unset var
recho ${var-$@}
recho ${var-"$@"}
recho ${var-$*}
recho ${var-"$*"}
unset -v a b c d
recho ${a=$@}
recho "$a"
recho ${b="$@"}
recho "$b"
recho ${c=$*}
recho "$c"
recho ${d="$*"}
recho "$d"
IFS=
unset var
recho ${var-$@}
recho ${var-"$@"}
recho ${var-$*}
recho ${var-"$*"}
unset -v a b c d
# Posix interp 221
recho ${a=$@}
recho "$a"
recho ${b="$@"}
recho "$b"
recho ${c=$*}
recho "$c"
recho ${d="$*"}
recho "$d"
+31
View File
@@ -0,0 +1,31 @@
set -- ' abc' 'def ghi' 'jkl '
echo normal IFS
recho $@
: ${var=$@}
recho $var
unset -v var
recho ${var-$@}
echo null IFS
IFS=
recho $@
: ${var=$@}
recho $var
unset -v var
recho ${var-$@}
echo non-standard IFS
IFS=:
recho $@
: ${var=$@}
recho $var
unset -v var
recho ${var-$@} # this is inconsistent
echo unset IFS
recho $@
: ${var=$@}
recho $var
unset -v var
recho ${var-$@}
+12 -2
View File
@@ -4309,7 +4309,7 @@ mk_env_string (name, value, isfunc)
int isfunc;
{
size_t name_len, value_len;
char *p, *q;
char *p, *q, *t;
name_len = strlen (name);
value_len = STRLEN (value);
@@ -4336,7 +4336,17 @@ mk_env_string (name, value, isfunc)
q[0] = '=';
if (value && *value)
memcpy (q + 1, value, value_len + 1);
{
if (isfunc)
{
t = dequote_escapes (value);
value_len = STRLEN (t);
memcpy (q + 1, t, value_len + 1);
free (t);
}
else
memcpy (q + 1, value, value_len + 1);
}
else
q[1] = '\0';