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
+145 -128
View File
@@ -703,8 +703,8 @@ 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, which is
a separate process (*note Command Execution Environment::). If the
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 when job control is not active.
@@ -1176,9 +1176,9 @@ list may be redirected to a single stream.
'()'
( LIST )
Placing a list of commands between parentheses causes a subshell
environment to be created (*note Command Execution Environment::),
and each of the commands in LIST to be executed in that subshell.
Placing a list of commands between parentheses forces the shell to
create a subshell (*note Command Execution Environment::), and each
of the commands in LIST is executed in that subshell environment.
Since the LIST is executed in a subshell, variable assignments do
not remain in effect after the subshell completes.
@@ -1423,7 +1423,8 @@ been shadowed will become visible.
the 'declare' ('typeset') builtin command (*note Bash Builtins::). The
'-F' option to 'declare' or 'typeset' will list the function names only
(and optionally the source file and line number, if the 'extdebug' shell
option is enabled). Functions may be exported so that subshells
option is enabled). Functions may be exported so that child shell
processes (those created when executing a separate shell invocation)
automatically have them defined with the '-f' option to the 'export'
builtin (*note Bourne Shell Builtins::).
@@ -1584,9 +1585,8 @@ only be referenced; assignment to them is not allowed.
shell itself (such as the '-i' option).
'$'
($$) Expands to the process ID of the shell. In a '()' subshell,
it expands to the process ID of the invoking shell, not the
subshell.
($$) Expands to the process ID of the shell. In a subshell, it
expands to the process ID of the invoking shell, not the subshell.
'!'
($!) Expands to the process ID of the job most recently placed
@@ -2382,6 +2382,14 @@ the following sub-patterns:
'!(PATTERN-LIST)'
Matches anything except one of the given patterns.
When matching filenames, the 'dotglob' shell option determines the
set of filenames that are tested: when 'dotglob' is enabled, the set of
filenames includes all files beginning with '.', but the filenames '.'
and '..' must be matched by a pattern or sub-pattern that begins with a
dot; when it is disabled, the set does not include any filenames
beginning with "." unless the pattern or sub-pattern begins with a '.'.
As above, '.' only has a special meaning when matching filenames.
Complicated extended pattern matching against long strings is slow,
especially when the patterns contain alternations and the strings
contain multiple matches. Using separate matches against shorter
@@ -2421,7 +2429,8 @@ file descriptor greater than 10 and assign it to {VARNAME}. If >&- or
<&- is preceded by {VARNAME}, the value of VARNAME defines the file
descriptor to close. If {VARNAME} is supplied, the redirection persists
beyond the scope of the command, allowing the shell programmer to manage
the file descriptor's lifetime manually.
the file descriptor's lifetime manually. The 'varredir_close' shell
option manages this behavior (*note The Shopt Builtin::).
In the following descriptions, if the file descriptor number is
omitted, and the first character of the redirection operator is '<', the
@@ -2805,6 +2814,8 @@ inherited from the shell.
A command invoked in this separate environment cannot affect the
shell's execution environment.
A "subshell" is a copy of the shell process.
Command substitution, commands grouped with parentheses, and
asynchronous commands are invoked in a subshell environment that is a
duplicate of the shell environment, except that traps caught by the
@@ -2960,8 +2971,8 @@ parameters are unset.
A shell script may be made executable by using the 'chmod' command to
turn on the execute bit. When Bash finds such a file while searching
the '$PATH' for a command, it spawns a subshell to execute it. In other
words, executing
the '$PATH' for a command, it creates a subshell to execute it. In
other words, executing
filename ARGUMENTS
is equivalent to executing
bash filename ARGUMENTS
@@ -4871,6 +4882,12 @@ This builtin allows you to change additional shell optional behavior.
find the directory containing the file supplied as an
argument. This option is enabled by default.
'varredir_close'
If set, the shell automatically closes file descriptors
assigned using the '{varname}' redirection syntax (*note
Redirections::) instead of leaving them open when the command
completes.
'xpg_echo'
If set, the 'echo' builtin expands backslash-escape sequences
by default.
@@ -11590,21 +11607,21 @@ D.3 Parameter and Variable Index
[index]
* Menu:
* !: Special Parameters. (line 56)
* !: Special Parameters. (line 55)
* #: Special Parameters. (line 39)
* $: Special Parameters. (line 51)
* $!: Special Parameters. (line 57)
* $!: Special Parameters. (line 56)
* $#: Special Parameters. (line 40)
* $$: Special Parameters. (line 52)
* $*: Special Parameters. (line 10)
* $-: Special Parameters. (line 47)
* $0: Special Parameters. (line 62)
* $0: Special Parameters. (line 61)
* $?: Special Parameters. (line 43)
* $@: Special Parameters. (line 23)
* $_: Bash Variables. (line 14)
* *: Special Parameters. (line 9)
* -: Special Parameters. (line 46)
* 0: Special Parameters. (line 61)
* 0: Special Parameters. (line 60)
* ?: Special Parameters. (line 42)
* @: Special Parameters. (line 22)
* _: Bash Variables. (line 13)
@@ -12215,118 +12232,118 @@ Node: Shell Commands23773
Node: Reserved Words24711
Node: Simple Commands25467
Node: Pipelines26121
Node: Lists29078
Node: Compound Commands30873
Node: Looping Constructs31885
Node: Conditional Constructs34380
Node: Command Grouping48670
Node: Coprocesses50145
Node: GNU Parallel52808
Node: Shell Functions53725
Node: Shell Parameters60945
Node: Positional Parameters65396
Node: Special Parameters66298
Node: Shell Expansions69522
Node: Brace Expansion71649
Node: Tilde Expansion74383
Node: Shell Parameter Expansion77004
Node: Command Substitution92133
Node: Arithmetic Expansion93488
Node: Process Substitution94420
Node: Word Splitting95540
Node: Filename Expansion97484
Node: Pattern Matching100084
Node: Quote Removal104202
Node: Redirections104497
Node: Executing Commands114071
Node: Simple Command Expansion114741
Node: Command Search and Execution116695
Node: Command Execution Environment119073
Node: Environment122059
Node: Exit Status123722
Node: Signals125506
Node: Shell Scripts127473
Node: Shell Builtin Commands130485
Node: Bourne Shell Builtins132523
Node: Bash Builtins153984
Node: Modifying Shell Behavior184498
Node: The Set Builtin184843
Node: The Shopt Builtin195256
Node: Special Builtins210217
Node: Shell Variables211196
Node: Bourne Shell Variables211633
Node: Bash Variables213737
Node: Bash Features246552
Node: Invoking Bash247565
Node: Bash Startup Files253578
Node: Interactive Shells258681
Node: What is an Interactive Shell?259091
Node: Is this Shell Interactive?259740
Node: Interactive Shell Behavior260555
Node: Bash Conditional Expressions264068
Node: Shell Arithmetic268710
Node: Aliases271654
Node: Arrays274267
Node: The Directory Stack280276
Node: Directory Stack Builtins281060
Node: Controlling the Prompt285320
Node: The Restricted Shell288285
Node: Bash POSIX Mode290882
Node: Shell Compatibility Mode302155
Node: Job Control308811
Node: Job Control Basics309271
Node: Job Control Builtins314273
Node: Job Control Variables319673
Node: Command Line Editing320829
Node: Introduction and Notation322500
Node: Readline Interaction324123
Node: Readline Bare Essentials325314
Node: Readline Movement Commands327097
Node: Readline Killing Commands328057
Node: Readline Arguments329975
Node: Searching331019
Node: Readline Init File333205
Node: Readline Init File Syntax334466
Node: Conditional Init Constructs355746
Node: Sample Init File359942
Node: Bindable Readline Commands363066
Node: Commands For Moving364270
Node: Commands For History366321
Node: Commands For Text371315
Node: Commands For Killing374964
Node: Numeric Arguments377997
Node: Commands For Completion379136
Node: Keyboard Macros383327
Node: Miscellaneous Commands384014
Node: Readline vi Mode389953
Node: Programmable Completion390860
Node: Programmable Completion Builtins398640
Node: A Programmable Completion Example409335
Node: Using History Interactively414582
Node: Bash History Facilities415266
Node: Bash History Builtins418271
Node: History Interaction423279
Node: Event Designators426899
Node: Word Designators428253
Node: Modifiers430013
Node: Installing Bash431824
Node: Basic Installation432961
Node: Compilers and Options436219
Node: Compiling For Multiple Architectures436960
Node: Installation Names438653
Node: Specifying the System Type439471
Node: Sharing Defaults440187
Node: Operation Controls440860
Node: Optional Features441818
Node: Reporting Bugs452618
Node: Major Differences From The Bourne Shell453893
Node: GNU Free Documentation License470743
Node: Indexes495920
Node: Builtin Index496374
Node: Reserved Word Index503201
Node: Variable Index505649
Node: Function Index522141
Node: Concept Index535925
Node: Lists29080
Node: Compound Commands30875
Node: Looping Constructs31887
Node: Conditional Constructs34382
Node: Command Grouping48672
Node: Coprocesses50150
Node: GNU Parallel52813
Node: Shell Functions53730
Node: Shell Parameters61021
Node: Positional Parameters65472
Node: Special Parameters66374
Node: Shell Expansions69588
Node: Brace Expansion71715
Node: Tilde Expansion74449
Node: Shell Parameter Expansion77070
Node: Command Substitution92199
Node: Arithmetic Expansion93554
Node: Process Substitution94486
Node: Word Splitting95606
Node: Filename Expansion97550
Node: Pattern Matching100150
Node: Quote Removal104758
Node: Redirections105053
Node: Executing Commands114713
Node: Simple Command Expansion115383
Node: Command Search and Execution117337
Node: Command Execution Environment119715
Node: Environment122750
Node: Exit Status124413
Node: Signals126197
Node: Shell Scripts128164
Node: Shell Builtin Commands131177
Node: Bourne Shell Builtins133215
Node: Bash Builtins154676
Node: Modifying Shell Behavior185190
Node: The Set Builtin185535
Node: The Shopt Builtin195948
Node: Special Builtins211158
Node: Shell Variables212137
Node: Bourne Shell Variables212574
Node: Bash Variables214678
Node: Bash Features247493
Node: Invoking Bash248506
Node: Bash Startup Files254519
Node: Interactive Shells259622
Node: What is an Interactive Shell?260032
Node: Is this Shell Interactive?260681
Node: Interactive Shell Behavior261496
Node: Bash Conditional Expressions265009
Node: Shell Arithmetic269651
Node: Aliases272595
Node: Arrays275208
Node: The Directory Stack281217
Node: Directory Stack Builtins282001
Node: Controlling the Prompt286261
Node: The Restricted Shell289226
Node: Bash POSIX Mode291823
Node: Shell Compatibility Mode303096
Node: Job Control309752
Node: Job Control Basics310212
Node: Job Control Builtins315214
Node: Job Control Variables320614
Node: Command Line Editing321770
Node: Introduction and Notation323441
Node: Readline Interaction325064
Node: Readline Bare Essentials326255
Node: Readline Movement Commands328038
Node: Readline Killing Commands328998
Node: Readline Arguments330916
Node: Searching331960
Node: Readline Init File334146
Node: Readline Init File Syntax335407
Node: Conditional Init Constructs356687
Node: Sample Init File360883
Node: Bindable Readline Commands364007
Node: Commands For Moving365211
Node: Commands For History367262
Node: Commands For Text372256
Node: Commands For Killing375905
Node: Numeric Arguments378938
Node: Commands For Completion380077
Node: Keyboard Macros384268
Node: Miscellaneous Commands384955
Node: Readline vi Mode390894
Node: Programmable Completion391801
Node: Programmable Completion Builtins399581
Node: A Programmable Completion Example410276
Node: Using History Interactively415523
Node: Bash History Facilities416207
Node: Bash History Builtins419212
Node: History Interaction424220
Node: Event Designators427840
Node: Word Designators429194
Node: Modifiers430954
Node: Installing Bash432765
Node: Basic Installation433902
Node: Compilers and Options437160
Node: Compiling For Multiple Architectures437901
Node: Installation Names439594
Node: Specifying the System Type440412
Node: Sharing Defaults441128
Node: Operation Controls441801
Node: Optional Features442759
Node: Reporting Bugs453559
Node: Major Differences From The Bourne Shell454834
Node: GNU Free Documentation License471684
Node: Indexes496861
Node: Builtin Index497315
Node: Reserved Word Index504142
Node: Variable Index506590
Node: Function Index523082
Node: Concept Index536866

End Tag Table