mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-09 13:10:50 +02:00
commit bash-20170407 snapshot
This commit is contained in:
+177
-159
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user