new option to auto-close varassign redirs; fixed some new parser error reporting issues

This commit is contained in:
Chet Ramey
2021-06-28 10:26:43 -04:00
parent 03de84de4a
commit 3fb16fce32
19 changed files with 2507 additions and 2373 deletions
+25 -16
View File
@@ -589,12 +589,12 @@ The
variable may be used to specify the format of
the time information.
.PP
Each command in a pipeline is executed as a separate process (i.e., in a
subshell).
Each command in a pipeline is executed in a \fIsubshell\fP, which is a
separate process.
See
.SM
\fBCOMMAND EXECUTION ENVIRONMENT\fP
for a description of a subshell environment.
for a description of subshells and a subshell environment.
If the \fBlastpipe\fP option is enabled using the \fBshopt\fP builtin
(see the description of \fBshopt\fP below),
the last element of a pipeline may be run by the shell process
@@ -673,10 +673,10 @@ the rest of the command by one or more newlines, and may be followed by a
newline in place of a semicolon.
.TP
(\fIlist\fP)
\fIlist\fP is executed in a subshell environment (see
\fIlist\fP is executed in a subshell (see
.SM
\fBCOMMAND EXECUTION ENVIRONMENT\fP
below).
below for a description of a subshell environment).
Variable assignments and builtin
commands that affect the shell's environment do not remain in effect
after the command completes. The return status is the exit status of
@@ -1278,10 +1278,7 @@ is evaluated as an arithmetic expression even if the $((...)) expansion is
not used (see
.B "Arithmetic Expansion"
below).
Word splitting is not performed, with the exception
of \fB"$@"\fP as explained below under
.BR "Special Parameters" .
Pathname expansion is not performed.
Word splitting and pathname expansion are not performed.
Assignment statements may also appear as arguments to the
.BR alias ,
.BR declare ,
@@ -1435,7 +1432,7 @@ builtin command, or those set by the shell itself
option).
.TP
.B $
Expands to the process ID of the shell. In a () subshell, it
Expands to the process ID of the shell. In a subshell, it
expands to the process ID of the current shell, not the
subshell.
.TP
@@ -3950,7 +3947,8 @@ by {\fIvarname\fP}, the value of \fIvarname\fP defines the file
descriptor to close.
If {\fIvarname\fP} is supplied, the redirection persists beyond
the scope of the command, allowing the shell programmer to manage
the file descriptor himself.
the file descriptor's lifetime manually.
The \fBvarredir_close\fP shell option manages this behavior.
.PP
In the following descriptions, if the file descriptor number is
omitted, and the first character of the redirection operator is
@@ -4503,7 +4501,8 @@ or
will list the function names only
(and optionally the source file and line number, if the \fBextdebug\fP
shell option is enabled).
Functions may be exported so that subshells
Functions may be exported so that child shell processes
(those created when executing a separate shell invocation)
automatically have them defined with the
.B \-f
option to the
@@ -4892,8 +4891,9 @@ to the command are set to the arguments given, if any.
If this execution fails because the file is not in executable
format, and the file is not a directory, it is assumed to be
a \fIshell script\fP, a file
containing shell commands. A subshell is spawned to execute
it. This subshell reinitializes itself, so
containing shell commands, and the shell creates a
to execute it.
This subshell reinitializes itself, so
that the effect is as if a new shell had been invoked
to handle the script, with the exception that the locations of
commands remembered by the parent (see
@@ -4949,8 +4949,8 @@ of \fB$$\fP, and the value of
When a simple command other than a builtin or shell function
is to be executed, it
is invoked in a separate execution environment that consists of
the following. Unless otherwise noted, the values are inherited
from the shell.
the following.
Unless otherwise noted, the values are inherited from the shell.
.if n .sp 1
.IP \(bu
the shell's open files, plus any modifications and additions specified
@@ -4969,6 +4969,8 @@ shell's parent, and traps ignored by the shell are ignored
A command invoked in this separate environment cannot affect the
shell's execution environment.
.PP
A \fIsubshell\fP is a copy of the shell process.
.PP
Command substitution, commands grouped with parentheses,
and asynchronous commands are invoked in a
subshell environment that is a duplicate of the shell environment,
@@ -10398,6 +10400,13 @@ If set, the
to find the directory containing the file supplied as an argument.
This option is enabled by default.
.TP 8
.B varredir_close
If set, the shell automatically closes file descriptors assigned using the
\fI{varname}\fP redirection syntax (see
.SM
.B REDIRECTION
above) instead of leaving them open when the command completes.
.TP 8
.B xpg_echo
If set, the \fBecho\fP builtin expands backslash-escape sequences
by default.