mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-07 02:32:27 +02:00
commit bash-20170331 snapshot
This commit is contained in:
+163
-149
@@ -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)
|
||||
@@ -633,7 +633,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 +656,12 @@ File: bashref.info, Node: Compound Commands, Next: Coprocesses, Prev: Lists,
|
||||
* 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 +706,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 +767,21 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
|
||||
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 +908,7 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
|
||||
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 +921,7 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
|
||||
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 +1256,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 +6217,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 +10868,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 +10892,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 +11499,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: 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
|
||||
|
||||
End Tag Table
|
||||
|
||||
Reference in New Issue
Block a user