mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 08:29:54 +02:00
changes to handling of "." and ".." when dotglob is enabled; other minor changes
This commit is contained in:
@@ -10484,3 +10484,55 @@ doc/{bash.1,bashref.texi}
|
||||
lib/glob/glob.c
|
||||
- skipname,wskipname: perform the special checks for `.' only if the
|
||||
pattern is not being negated
|
||||
|
||||
6/3
|
||||
---
|
||||
parse.y,shell.h
|
||||
- eol_ungetc_lookahead: save and restore as part of the parser state
|
||||
included in {save,restore}_parser_state
|
||||
|
||||
6/7
|
||||
---
|
||||
lib/readline/display.c
|
||||
- puts_face: make sure to cast each member of STR to unsigned char, so
|
||||
it's not misinterpreted as EOF, which putc_face does not display.
|
||||
Report and fix from Volodymyr Prodan <vovcat@gmail.com> in
|
||||
https://savannah.gnu.org/patch/?10076
|
||||
|
||||
examples/shobj-conf
|
||||
- aix*gcc: change SHOBJ_LD to ${CC}, prefix the SHOBJ_LDFLAGS flags
|
||||
with -Wl, so gcc will pass them to the linker. Report from
|
||||
lehel@maxer.hu in https://savannah.gnu.org/support/?110505
|
||||
|
||||
6/11
|
||||
----
|
||||
doc/{bash.1,bashref.texi}
|
||||
- cd: additional arguments are not ignored; they raise an error.
|
||||
Report from Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
|
||||
|
||||
lib/glob/strmatch.h
|
||||
- FNM_DOTDOT: enable special handling for `.' and `..': if FNM_PERIOD
|
||||
is not set, `.' and `..' at the start of a string or as a pathname
|
||||
component need to be matched by a `.' in the pattern and cannot be
|
||||
matched by `?', `*', or a bracket expression
|
||||
|
||||
lib/glob/glob.c
|
||||
- glob_vector: pass FNM_DOTDOT to strmatch() if noglob_dot_filenames
|
||||
is not set to enable special handling of `.' and `..'. Prompted by a
|
||||
discussion with Nora Platiel <nplatiel@gmx.us>
|
||||
- skipname,wskipname: remove special checks for `.' and (disabled)
|
||||
checks for `..'
|
||||
|
||||
lib/glob/sm_loop.c
|
||||
- GMATCH: implement special handling for FNM_DOTDOT and `.' and `..':
|
||||
make sure they can't be matched by any special glob characters at
|
||||
the start of the string or as a pathname component (if FNM_PATHNAME
|
||||
is set). This also means that !(pattern) won't return `.' or `..'
|
||||
if dotglob is set
|
||||
- GMATCH,EXTMATCH: don't pass FNM_DOTDOT down to recursive calls, like
|
||||
FNM_PERIOD, once we process the first character in the string or
|
||||
pathname component
|
||||
|
||||
lib/glob/smatch.c
|
||||
- ISDIRSEP,PATHSEP,SDOT_OR_DOTDOT,PDOT_OR_DOTDOT: provide definitions
|
||||
for single-byte or wide character strings for sm_loop.c to use
|
||||
|
||||
@@ -1109,6 +1109,7 @@ tests/extglob3.right f
|
||||
tests/extglob4.sub f
|
||||
tests/extglob5.sub f
|
||||
tests/extglob6.sub f
|
||||
tests/extglob7.sub f
|
||||
tests/func.tests f
|
||||
tests/func.right f
|
||||
tests/func1.sub f
|
||||
|
||||
+1925
-1924
File diff suppressed because it is too large
Load Diff
+8
-10
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Mon May 10 10:12:31 EDT 2021
|
||||
.\" Last Change: Tue Jun 15 09:39:48 EDT 2021
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2021 May 10" "GNU Bash 5.1"
|
||||
.TH BASH 1 "2021 June 15" "GNU Bash 5.1"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -3687,14 +3687,11 @@ at the start of a name or immediately following a slash
|
||||
must be matched explicitly, unless the shell option
|
||||
.B dotglob
|
||||
is set.
|
||||
The filenames
|
||||
In order to match the filenames
|
||||
.B ``.''
|
||||
and
|
||||
.B ``..''
|
||||
must always be matched
|
||||
by a pattern beginning with ``.'' (for example, ``.?''),
|
||||
or a pattern beginning with ``.'' must be one of the patterns in an
|
||||
extended pattern matching expression (see below),
|
||||
.BR ``..'' ,
|
||||
the pattern must begin with ``.'' (for example, ``.?''),
|
||||
even if
|
||||
.B dotglob
|
||||
is set.
|
||||
@@ -3879,6 +3876,8 @@ If the \fBextglob\fP shell option is enabled using the \fBshopt\fP
|
||||
builtin, the shell recognizes several extended pattern matching operators.
|
||||
In the following description, a \fIpattern-list\fP is a list of one
|
||||
or more patterns separated by a \fB|\fP.
|
||||
When matching filenames, the \fBdotglob\fP shell option determines
|
||||
the set of filenames that are tested, as described above.
|
||||
Composite patterns may be formed using one or more of the following
|
||||
sub-patterns:
|
||||
.sp 1
|
||||
@@ -3898,7 +3897,7 @@ Matches one or more occurrences of the given patterns
|
||||
Matches one of the given patterns
|
||||
.TP
|
||||
\fB!(\fP\^\fIpattern-list\^\fP\fB)\fP
|
||||
Matches anything except one of the given patterns
|
||||
Matches anything except one of the given patterns.
|
||||
.RE
|
||||
.PD
|
||||
.PP
|
||||
@@ -7723,7 +7722,6 @@ if \fIdir\fP is not supplied, the value of the
|
||||
.SM
|
||||
.B HOME
|
||||
shell variable is the default.
|
||||
Any additional arguments following \fIdir\fP are ignored.
|
||||
The variable
|
||||
.SM
|
||||
.B CDPATH
|
||||
|
||||
+164
-165
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.7 from
|
||||
bashref.texi.
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.1, 18 May 2021).
|
||||
Bash shell (version 5.1, 15 June 2021).
|
||||
|
||||
This is Edition 5.1, last updated 18 May 2021, of 'The GNU Bash
|
||||
This is Edition 5.1, last updated 15 June 2021, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.1.
|
||||
|
||||
Copyright (C) 1988-2021 Free Software Foundation, Inc.
|
||||
@@ -27,10 +27,10 @@ Bash Features
|
||||
*************
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.1, 18 May 2021). The Bash home page is
|
||||
Bash shell (version 5.1, 15 June 2021). The Bash home page is
|
||||
<http://www.gnu.org/software/bash/>.
|
||||
|
||||
This is Edition 5.1, last updated 18 May 2021, of 'The GNU Bash
|
||||
This is Edition 5.1, last updated 15 June 2021, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.1.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
@@ -2271,12 +2271,10 @@ characters.
|
||||
|
||||
When a pattern is used for filename expansion, the character '.' at
|
||||
the start of a filename or immediately following a slash must be matched
|
||||
explicitly, unless the shell option 'dotglob' is set. The filenames '.'
|
||||
and '..' must be matched by a pattern beginning with '.' (for example,
|
||||
'.?'), or a pattern beginning with '.' must be one of the patterns in an
|
||||
extended pattern matching expression (see below), even if 'dotglob' is
|
||||
set. When not matching filenames, the '.' character is not treated
|
||||
specially.
|
||||
explicitly, unless the shell option 'dotglob' is set. In order to match
|
||||
the filenames '.' and '..', the pattern must begin with '.' (for
|
||||
example, '.?'), even if 'dotglob' is set. When not matching filenames,
|
||||
the '.' character is not treated specially.
|
||||
|
||||
When matching a filename, the slash character must always be matched
|
||||
explicitly by a slash in the pattern, but in other matching contexts it
|
||||
@@ -2364,8 +2362,10 @@ characters must be quoted if they are to be matched literally.
|
||||
If the 'extglob' shell option is enabled using the 'shopt' builtin,
|
||||
the shell recognizes several extended pattern matching operators. In
|
||||
the following description, a PATTERN-LIST is a list of one or more
|
||||
patterns separated by a '|'. Composite patterns may be formed using one
|
||||
or more of the following sub-patterns:
|
||||
patterns separated by a '|'. When matching filenames, the 'dotglob'
|
||||
shell option determines the set of filenames that are tested, as
|
||||
described above. Composite patterns may be formed using one or more of
|
||||
the following sub-patterns:
|
||||
|
||||
'?(PATTERN-LIST)'
|
||||
Matches zero or one occurrence of the given patterns.
|
||||
@@ -3091,10 +3091,9 @@ standard.
|
||||
cd [-L|[-P [-e]] [-@] [DIRECTORY]
|
||||
|
||||
Change the current working directory to DIRECTORY. If DIRECTORY is
|
||||
not supplied, the value of the 'HOME' shell variable is used. Any
|
||||
additional arguments following DIRECTORY are ignored. If the shell
|
||||
variable 'CDPATH' exists, it is used as a search path: each
|
||||
directory name in 'CDPATH' is searched for DIRECTORY, with
|
||||
not supplied, the value of the 'HOME' shell variable is used. If
|
||||
the shell variable 'CDPATH' exists, it is used as a search path:
|
||||
each directory name in 'CDPATH' is searched for DIRECTORY, with
|
||||
alternative directory names in 'CDPATH' separated by a colon (':').
|
||||
If DIRECTORY begins with a slash, 'CDPATH' is not used.
|
||||
|
||||
@@ -11448,7 +11447,7 @@ D.1 Index of Shell Builtin Commands
|
||||
* :: Bourne Shell Builtins.
|
||||
(line 11)
|
||||
* [: Bourne Shell Builtins.
|
||||
(line 275)
|
||||
(line 274)
|
||||
* alias: Bash Builtins. (line 11)
|
||||
* bg: Job Control Builtins.
|
||||
(line 7)
|
||||
@@ -11467,7 +11466,7 @@ D.1 Index of Shell Builtin Commands
|
||||
* compopt: Programmable Completion Builtins.
|
||||
(line 237)
|
||||
* continue: Bourne Shell Builtins.
|
||||
(line 90)
|
||||
(line 89)
|
||||
* declare: Bash Builtins. (line 154)
|
||||
* dirs: Directory Stack Builtins.
|
||||
(line 7)
|
||||
@@ -11476,21 +11475,21 @@ D.1 Index of Shell Builtin Commands
|
||||
* echo: Bash Builtins. (line 257)
|
||||
* enable: Bash Builtins. (line 306)
|
||||
* eval: Bourne Shell Builtins.
|
||||
(line 99)
|
||||
(line 98)
|
||||
* exec: Bourne Shell Builtins.
|
||||
(line 107)
|
||||
(line 106)
|
||||
* exit: Bourne Shell Builtins.
|
||||
(line 125)
|
||||
(line 124)
|
||||
* export: Bourne Shell Builtins.
|
||||
(line 132)
|
||||
(line 131)
|
||||
* fc: Bash History Builtins.
|
||||
(line 10)
|
||||
* fg: Job Control Builtins.
|
||||
(line 17)
|
||||
* getopts: Bourne Shell Builtins.
|
||||
(line 148)
|
||||
(line 147)
|
||||
* hash: Bourne Shell Builtins.
|
||||
(line 192)
|
||||
(line 191)
|
||||
* help: Bash Builtins. (line 338)
|
||||
* history: Bash History Builtins.
|
||||
(line 46)
|
||||
@@ -11508,34 +11507,34 @@ D.1 Index of Shell Builtin Commands
|
||||
* pushd: Directory Stack Builtins.
|
||||
(line 69)
|
||||
* pwd: Bourne Shell Builtins.
|
||||
(line 212)
|
||||
(line 211)
|
||||
* read: Bash Builtins. (line 481)
|
||||
* readarray: Bash Builtins. (line 577)
|
||||
* readonly: Bourne Shell Builtins.
|
||||
(line 222)
|
||||
(line 221)
|
||||
* return: Bourne Shell Builtins.
|
||||
(line 241)
|
||||
(line 240)
|
||||
* set: The Set Builtin. (line 11)
|
||||
* shift: Bourne Shell Builtins.
|
||||
(line 262)
|
||||
(line 261)
|
||||
* shopt: The Shopt Builtin. (line 9)
|
||||
* source: Bash Builtins. (line 586)
|
||||
* suspend: Job Control Builtins.
|
||||
(line 113)
|
||||
* test: Bourne Shell Builtins.
|
||||
(line 275)
|
||||
(line 274)
|
||||
* times: Bourne Shell Builtins.
|
||||
(line 360)
|
||||
(line 359)
|
||||
* trap: Bourne Shell Builtins.
|
||||
(line 366)
|
||||
(line 365)
|
||||
* type: Bash Builtins. (line 591)
|
||||
* typeset: Bash Builtins. (line 623)
|
||||
* ulimit: Bash Builtins. (line 629)
|
||||
* umask: Bourne Shell Builtins.
|
||||
(line 415)
|
||||
(line 414)
|
||||
* unalias: Bash Builtins. (line 735)
|
||||
* unset: Bourne Shell Builtins.
|
||||
(line 433)
|
||||
(line 432)
|
||||
* wait: Job Control Builtins.
|
||||
(line 76)
|
||||
|
||||
@@ -12195,138 +12194,138 @@ D.5 Concept Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top887
|
||||
Node: Introduction2797
|
||||
Node: What is Bash?3013
|
||||
Node: What is a shell?4127
|
||||
Node: Definitions6665
|
||||
Node: Basic Shell Features9616
|
||||
Node: Shell Syntax10835
|
||||
Node: Shell Operation11861
|
||||
Node: Quoting13154
|
||||
Node: Escape Character14458
|
||||
Node: Single Quotes14943
|
||||
Node: Double Quotes15291
|
||||
Node: ANSI-C Quoting16569
|
||||
Node: Locale Translation17879
|
||||
Node: Creating Internationalized Scripts19034
|
||||
Node: Comments23151
|
||||
Node: Shell Commands23769
|
||||
Node: Reserved Words24707
|
||||
Node: Simple Commands25463
|
||||
Node: Pipelines26117
|
||||
Node: Lists29074
|
||||
Node: Compound Commands30869
|
||||
Node: Looping Constructs31881
|
||||
Node: Conditional Constructs34376
|
||||
Node: Command Grouping48666
|
||||
Node: Coprocesses50141
|
||||
Node: GNU Parallel52804
|
||||
Node: Shell Functions53721
|
||||
Node: Shell Parameters60941
|
||||
Node: Positional Parameters65392
|
||||
Node: Special Parameters66294
|
||||
Node: Shell Expansions69518
|
||||
Node: Brace Expansion71645
|
||||
Node: Tilde Expansion74379
|
||||
Node: Shell Parameter Expansion77000
|
||||
Node: Command Substitution92129
|
||||
Node: Arithmetic Expansion93484
|
||||
Node: Process Substitution94416
|
||||
Node: Word Splitting95536
|
||||
Node: Filename Expansion97480
|
||||
Node: Pattern Matching100193
|
||||
Node: Quote Removal104189
|
||||
Node: Redirections104484
|
||||
Node: Executing Commands114058
|
||||
Node: Simple Command Expansion114728
|
||||
Node: Command Search and Execution116682
|
||||
Node: Command Execution Environment119060
|
||||
Node: Environment122046
|
||||
Node: Exit Status123709
|
||||
Node: Signals125493
|
||||
Node: Shell Scripts127460
|
||||
Node: Shell Builtin Commands130472
|
||||
Node: Bourne Shell Builtins132510
|
||||
Node: Bash Builtins154035
|
||||
Node: Modifying Shell Behavior184549
|
||||
Node: The Set Builtin184894
|
||||
Node: The Shopt Builtin195307
|
||||
Node: Special Builtins210268
|
||||
Node: Shell Variables211247
|
||||
Node: Bourne Shell Variables211684
|
||||
Node: Bash Variables213788
|
||||
Node: Bash Features246603
|
||||
Node: Invoking Bash247616
|
||||
Node: Bash Startup Files253629
|
||||
Node: Interactive Shells258732
|
||||
Node: What is an Interactive Shell?259142
|
||||
Node: Is this Shell Interactive?259791
|
||||
Node: Interactive Shell Behavior260606
|
||||
Node: Bash Conditional Expressions264119
|
||||
Node: Shell Arithmetic268761
|
||||
Node: Aliases271705
|
||||
Node: Arrays274318
|
||||
Node: The Directory Stack280327
|
||||
Node: Directory Stack Builtins281111
|
||||
Node: Controlling the Prompt285371
|
||||
Node: The Restricted Shell288336
|
||||
Node: Bash POSIX Mode290930
|
||||
Node: Shell Compatibility Mode302203
|
||||
Node: Job Control308859
|
||||
Node: Job Control Basics309319
|
||||
Node: Job Control Builtins314321
|
||||
Node: Job Control Variables319721
|
||||
Node: Command Line Editing320877
|
||||
Node: Introduction and Notation322548
|
||||
Node: Readline Interaction324171
|
||||
Node: Readline Bare Essentials325362
|
||||
Node: Readline Movement Commands327145
|
||||
Node: Readline Killing Commands328105
|
||||
Node: Readline Arguments330023
|
||||
Node: Searching331067
|
||||
Node: Readline Init File333253
|
||||
Node: Readline Init File Syntax334512
|
||||
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: Top889
|
||||
Node: Introduction2801
|
||||
Node: What is Bash?3017
|
||||
Node: What is a shell?4131
|
||||
Node: Definitions6669
|
||||
Node: Basic Shell Features9620
|
||||
Node: Shell Syntax10839
|
||||
Node: Shell Operation11865
|
||||
Node: Quoting13158
|
||||
Node: Escape Character14462
|
||||
Node: Single Quotes14947
|
||||
Node: Double Quotes15295
|
||||
Node: ANSI-C Quoting16573
|
||||
Node: Locale Translation17883
|
||||
Node: Creating Internationalized Scripts19038
|
||||
Node: Comments23155
|
||||
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 Mode290879
|
||||
Node: Shell Compatibility Mode302152
|
||||
Node: Job Control308808
|
||||
Node: Job Control Basics309268
|
||||
Node: Job Control Builtins314270
|
||||
Node: Job Control Variables319670
|
||||
Node: Command Line Editing320826
|
||||
Node: Introduction and Notation322497
|
||||
Node: Readline Interaction324120
|
||||
Node: Readline Bare Essentials325311
|
||||
Node: Readline Movement Commands327094
|
||||
Node: Readline Killing Commands328054
|
||||
Node: Readline Arguments329972
|
||||
Node: Searching331016
|
||||
Node: Readline Init File333202
|
||||
Node: Readline Init File Syntax334461
|
||||
Node: Conditional Init Constructs355695
|
||||
Node: Sample Init File359891
|
||||
Node: Bindable Readline Commands363015
|
||||
Node: Commands For Moving364219
|
||||
Node: Commands For History366270
|
||||
Node: Commands For Text371264
|
||||
Node: Commands For Killing374913
|
||||
Node: Numeric Arguments377946
|
||||
Node: Commands For Completion379085
|
||||
Node: Keyboard Macros383276
|
||||
Node: Miscellaneous Commands383963
|
||||
Node: Readline vi Mode389902
|
||||
Node: Programmable Completion390809
|
||||
Node: Programmable Completion Builtins398589
|
||||
Node: A Programmable Completion Example409284
|
||||
Node: Using History Interactively414531
|
||||
Node: Bash History Facilities415215
|
||||
Node: Bash History Builtins418220
|
||||
Node: History Interaction423228
|
||||
Node: Event Designators426848
|
||||
Node: Word Designators428202
|
||||
Node: Modifiers429962
|
||||
Node: Installing Bash431773
|
||||
Node: Basic Installation432910
|
||||
Node: Compilers and Options436168
|
||||
Node: Compiling For Multiple Architectures436909
|
||||
Node: Installation Names438602
|
||||
Node: Specifying the System Type439420
|
||||
Node: Sharing Defaults440136
|
||||
Node: Operation Controls440809
|
||||
Node: Optional Features441767
|
||||
Node: Reporting Bugs452567
|
||||
Node: Major Differences From The Bourne Shell453842
|
||||
Node: GNU Free Documentation License470692
|
||||
Node: Indexes495869
|
||||
Node: Builtin Index496323
|
||||
Node: Reserved Word Index503150
|
||||
Node: Variable Index505598
|
||||
Node: Function Index522090
|
||||
Node: Concept Index535874
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
+4
-5
@@ -2661,10 +2661,8 @@ without regard to the case of alphabetic characters.
|
||||
When a pattern is used for filename expansion, the character @samp{.}
|
||||
at the start of a filename or immediately following a slash
|
||||
must be matched explicitly, unless the shell option @code{dotglob} is set.
|
||||
The filenames @samp{.} and @samp{..} must be matched
|
||||
by a pattern beginning with @samp{.} (for example, @samp{.?}),
|
||||
or a pattern beginning with @samp{.} must be one of the patterns in an
|
||||
extended pattern matching expression (see below),
|
||||
In order to match the filenames @samp{.} and @samp{..},
|
||||
the pattern must begin with @samp{.} (for example, @samp{.?}),
|
||||
even if @code{dotglob} is set.
|
||||
When not matching filenames, the @samp{.} character is not treated specially.
|
||||
|
||||
@@ -2772,6 +2770,8 @@ If the @code{extglob} shell option is enabled using the @code{shopt}
|
||||
builtin, the shell recognizes several extended pattern matching operators.
|
||||
In the following description, a @var{pattern-list} is a list of one
|
||||
or more patterns separated by a @samp{|}.
|
||||
When matching filenames, the @code{dotglob} shell option determines
|
||||
the set of filenames that are tested, as described above.
|
||||
Composite patterns may be formed using one or more of the following
|
||||
sub-patterns:
|
||||
|
||||
@@ -3616,7 +3616,6 @@ cd [-L|[-P [-e]] [-@@] [@var{directory}]
|
||||
Change the current working directory to @var{directory}.
|
||||
If @var{directory} is not supplied, the value of the @env{HOME}
|
||||
shell variable is used.
|
||||
Any additional arguments following @var{directory} are ignored.
|
||||
If the shell variable
|
||||
@env{CDPATH} exists, it is used as a search path:
|
||||
each directory name in @env{CDPATH} is searched for
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2021 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Tue May 18 11:34:00 EDT 2021
|
||||
@set LASTCHANGE Tue Jun 15 09:40:11 EDT 2021
|
||||
|
||||
@set EDITION 5.1
|
||||
@set VERSION 5.1
|
||||
|
||||
@set UPDATED 18 May 2021
|
||||
@set UPDATED-MONTH May 2021
|
||||
@set UPDATED 15 June 2021
|
||||
@set UPDATED-MONTH June 2021
|
||||
|
||||
@@ -289,6 +289,7 @@ typedef int QSFUNC ();
|
||||
#define PATHSEP(c) (ISDIRSEP(c) || (c) == 0)
|
||||
|
||||
#define DOT_OR_DOTDOT(s) (s[0] == '.' && (s[1] == 0 || (s[1] == '.' && s[2] == 0)))
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
#define WDOT_OR_DOTDOT(w) (w[0] == L'.' && (w[1] == L'\0' || (w[1] == L'.' && w[2] == L'\0')))
|
||||
#endif
|
||||
|
||||
+2
-44
@@ -1,6 +1,6 @@
|
||||
/* glob.c -- file-name wildcard pattern matching for Bash.
|
||||
|
||||
Copyright (C) 1985-2020 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne-Again SHell.
|
||||
|
||||
@@ -304,35 +304,6 @@ skipname (pat, dname, flags)
|
||||
pat[0] != '.' && (pat[0] != '\\' || pat[1] != '.'))
|
||||
return 1;
|
||||
|
||||
/* Special checks for `.'. The only things that can match `.' are ".",
|
||||
"\.", ".*", and "\.*". We don't try to match everything here, just
|
||||
make sure that we don't let something obviously disqualifying by.
|
||||
We only do this if we're not negating the pattern. */
|
||||
else if ((flags & GX_NEGATE) == 0 && dname[0] == '.' && dname[1] == '\0')
|
||||
{
|
||||
if (pat[0] != '.' && (pat[0] != '\\' || pat[1] != '.'))
|
||||
return 1;
|
||||
i = (pat[0] == '.') ? 1 : 2;
|
||||
if (pat[i] && pat[i] != '*')
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* These are additional special checks for `..'. We let through "..",
|
||||
"\..", ".\.", "\.\.", ".*", ".?", "\.*", and "\.?".
|
||||
Disabled because it doesn't deal with things like `@(.).' at all. */
|
||||
else if (dname[0] == '.' && dname[1] == '.' && dname[2] == '\0')
|
||||
{
|
||||
if (pat[0] != '.' && (pat[0] != '\\' || pat[1] != '.')) /* [\]. */
|
||||
return 1;
|
||||
i = (pat[0] == '.') ? 1 : 2;
|
||||
if (pat[i] && (pat[i] == '*' || pat[i] == '?') && pat[i+1] == '\0')
|
||||
return 0; /* [\].[*?] */
|
||||
if (pat[i] != '.' && (pat[i] != '\\' || pat[i+1] != '.')) /* [\].[\]. */
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -371,19 +342,6 @@ wskipname (pat, dname, flags)
|
||||
pat[0] != L'.' && (pat[0] != L'\\' || pat[1] != L'.'))
|
||||
return 1;
|
||||
|
||||
/* Special checks for `.'. The only things that can match `.' are ".",
|
||||
"\.", ".*", and "\.*". We don't try to match everything here, just
|
||||
make sure that we don't let something obviously disqualifying by.
|
||||
We only do this if we're not negating the pattern. */
|
||||
else if ((flags & GX_NEGATE) == 0 && dname[0] == L'.' && dname[1] == L'\0')
|
||||
{
|
||||
if (pat[0] != L'.' && (pat[0] != L'\\' || pat[1] != L'.'))
|
||||
return 1;
|
||||
i = (pat[0] == L'.') ? 1 : 2;
|
||||
if (pat[i] != L'\0' && pat[i] != L'*')
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -848,7 +806,7 @@ glob_vector (pat, dir, flags)
|
||||
|
||||
/* Compute the flags that will be passed to strmatch(). We don't
|
||||
need to do this every time through the loop. */
|
||||
mflags = (noglob_dot_filenames ? FNM_PERIOD : 0) | FNM_PATHNAME;
|
||||
mflags = (noglob_dot_filenames ? FNM_PERIOD : FNM_DOTDOT) | FNM_PATHNAME;
|
||||
|
||||
#ifdef FNM_CASEFOLD
|
||||
if (glob_ignore_case)
|
||||
|
||||
+43
-8
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -83,6 +83,7 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
|
||||
#ifdef EXTENDED_GLOB
|
||||
/* EXTMATCH () will handle recursively calling GMATCH, so we can
|
||||
|
||||
just return what EXTMATCH() returns. */
|
||||
if ((flags & FNM_EXTMATCH) && *p == L('(') &&
|
||||
(c == L('+') || c == L('*') || c == L('?') || c == L('@') || c == L('!'))) /* ) */
|
||||
@@ -90,7 +91,7 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
int lflags;
|
||||
/* If we're not matching the start of the string, we're not
|
||||
concerned about the special cases for matching `.' */
|
||||
lflags = (n == string) ? flags : (flags & ~FNM_PERIOD);
|
||||
lflags = (n == string) ? flags : (flags & ~(FNM_PERIOD|FNM_DOTDOT));
|
||||
return (EXTMATCH (c, n, se, p, pe, lflags));
|
||||
}
|
||||
#endif /* EXTENDED_GLOB */
|
||||
@@ -109,6 +110,15 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
string or if it is the first character following a slash and
|
||||
we are matching a pathname. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
/* `?' cannot match `.' or `..' if it is the first character of the
|
||||
string or if it is the first character following a slash and
|
||||
we are matching a pathname. */
|
||||
if ((flags & FNM_DOTDOT) &&
|
||||
((n == string && SDOT_OR_DOTDOT(n)) ||
|
||||
((flags & FNM_PATHNAME) && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
break;
|
||||
|
||||
case L('\\'): /* backslash escape removes special meaning */
|
||||
@@ -147,6 +157,14 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
we are matching a pathname. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
/* `*' cannot match `.' or `..' if it is the first character of the
|
||||
string or if it is the first character following a slash and
|
||||
we are matching a pathname. */
|
||||
if ((flags & FNM_DOTDOT) &&
|
||||
((n == string && SDOT_OR_DOTDOT(n)) ||
|
||||
((flags & FNM_PATHNAME) && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (p == pe)
|
||||
return 0;
|
||||
|
||||
@@ -288,7 +306,7 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
continue;
|
||||
|
||||
/* Otherwise, we just recurse. */
|
||||
if (GMATCH (n, se, p, pe, &end, flags & ~FNM_PERIOD) == 0)
|
||||
if (GMATCH (n, se, p, pe, &end, flags & ~(FNM_PERIOD|FNM_DOTDOT)) == 0)
|
||||
{
|
||||
if (end.pattern == NULL)
|
||||
return (0);
|
||||
@@ -321,6 +339,14 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
(n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
|
||||
return (FNM_NOMATCH);
|
||||
|
||||
/* `?' cannot match `.' or `..' if it is the first character of the
|
||||
string or if it is the first character following a slash and
|
||||
we are matching a pathname. */
|
||||
if ((flags & FNM_DOTDOT) &&
|
||||
((n == string && SDOT_OR_DOTDOT(n)) ||
|
||||
((flags & FNM_PATHNAME) && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
p = BRACKMATCH (p, sc, flags);
|
||||
if (p == 0)
|
||||
return FNM_NOMATCH;
|
||||
@@ -843,7 +869,7 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
|
||||
if (m1)
|
||||
{
|
||||
/* if srest > s, we are not at start of string */
|
||||
xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
||||
xflags = (srest > s) ? (flags & ~(FNM_PERIOD|FNM_DOTDOT)) : flags;
|
||||
m2 = (GMATCH (srest, se, prest, pe, NULL, xflags) == 0) ||
|
||||
(s != srest && GMATCH (srest, se, p - 1, pe, NULL, xflags) == 0);
|
||||
}
|
||||
@@ -873,7 +899,7 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
|
||||
for ( ; srest <= se; srest++)
|
||||
{
|
||||
/* if srest > s, we are not at start of string */
|
||||
xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
||||
xflags = (srest > s) ? (flags & ~(FNM_PERIOD|FNM_DOTDOT)) : flags;
|
||||
if (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0 &&
|
||||
GMATCH (srest, se, prest, pe, NULL, xflags) == 0)
|
||||
return (0);
|
||||
@@ -899,12 +925,17 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
|
||||
|
||||
/* If nothing matched, but the string starts with a period and we
|
||||
need to match periods explicitly, don't return this as a match,
|
||||
even for negation. Might need to do this only if srest == s. */
|
||||
if (m1 == 0 && *s == '.' && (flags & FNM_PERIOD))
|
||||
even for negation. */
|
||||
if (m1 == 0 && (flags & FNM_PERIOD) && *s == '.')
|
||||
return (FNM_NOMATCH);
|
||||
|
||||
if (m1 == 0 && (flags & FNM_DOTDOT) &&
|
||||
(SDOT_OR_DOTDOT (s) ||
|
||||
((flags & FNM_PATHNAME) && s[-1] == L('/') && PDOT_OR_DOTDOT(s))))
|
||||
return (FNM_NOMATCH);
|
||||
|
||||
/* if srest > s, we are not at start of string */
|
||||
xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
||||
xflags = (srest > s) ? (flags & ~(FNM_PERIOD|FNM_DOTDOT)) : flags;
|
||||
if (m1 == 0 && GMATCH (srest, se, prest, pe, NULL, xflags) == 0)
|
||||
return (0);
|
||||
}
|
||||
@@ -939,4 +970,8 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
|
||||
#undef MEMCHR
|
||||
#undef COLLEQUIV
|
||||
#undef RANGECMP
|
||||
#undef ISDIRSEP
|
||||
#undef PATHSEP
|
||||
#undef PDOT_OR_DOTDOT
|
||||
#undef SDOT_OR_DOTDOT
|
||||
#undef L
|
||||
|
||||
+22
-1
@@ -1,7 +1,7 @@
|
||||
/* strmatch.c -- ksh-like extended pattern matching for the shell and filename
|
||||
globbing. */
|
||||
|
||||
/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -308,6 +308,16 @@ is_cclass (c, name)
|
||||
? TOLOWER ((unsigned char)c) \
|
||||
: ((unsigned char)c))
|
||||
|
||||
#if !defined (__CYGWIN__)
|
||||
# define ISDIRSEP(c) ((c) == '/')
|
||||
#else
|
||||
# define ISDIRSEP(c) ((c) == '/' || (c) == '\\')
|
||||
#endif /* __CYGWIN__ */
|
||||
#define PATHSEP(c) (ISDIRSEP(c) || (c) == 0)
|
||||
|
||||
# define PDOT_OR_DOTDOT(s) (s[0] == '.' && (PATHSEP (s[1]) || (s[1] == '.' && PATHSEP (s[2]))))
|
||||
# define SDOT_OR_DOTDOT(s) (s[0] == '.' && (s[1] == 0 || (s[1] == '.' && s[2] == 0)))
|
||||
|
||||
#define FCT internal_strmatch
|
||||
#define GMATCH gmatch
|
||||
#define COLLSYM collsym
|
||||
@@ -553,6 +563,17 @@ posix_cclass_only (pattern)
|
||||
|
||||
/* Now include `sm_loop.c' for multibyte characters. */
|
||||
#define FOLD(c) ((flags & FNM_CASEFOLD) && iswupper (c) ? towlower (c) : (c))
|
||||
|
||||
# if !defined (__CYGWIN__)
|
||||
# define ISDIRSEP(c) ((c) == L'/')
|
||||
# else
|
||||
# define ISDIRSEP(c) ((c) == L'/' || (c) == L'\\')
|
||||
# endif /* __CYGWIN__ */
|
||||
# define PATHSEP(c) (ISDIRSEP(c) || (c) == L'\0')
|
||||
|
||||
# define PDOT_OR_DOTDOT(w) (w[0] == L'.' && (PATHSEP(w[1]) || (w[1] == L'.' && PATHSEP(w[2]))))
|
||||
# define SDOT_OR_DOTDOT(w) (w[0] == L'.' && (w[1] == L'\0' || (w[1] == L'.' && w[2] == L'\0')))
|
||||
|
||||
#define FCT internal_wstrmatch
|
||||
#define GMATCH gmatch_wc
|
||||
#define COLLSYM collwcsym
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne-Again SHell.
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
|
||||
|
||||
#define FNM_FIRSTCHAR (1 << 6) /* Match only the first character */
|
||||
#define FNM_DOTDOT (1 << 7) /* force `.' and `..' to match explicitly even if FNM_PERIOD not supplied. */
|
||||
|
||||
/* Value returned by `strmatch' if STRING does not match PATTERN. */
|
||||
#undef FNM_NOMATCH
|
||||
|
||||
@@ -1598,7 +1598,7 @@ puts_face (const char *str, const char *face, int n)
|
||||
char cur_face;
|
||||
|
||||
for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
|
||||
putc_face (str[i], face[i], &cur_face);
|
||||
putc_face ((unsigned char) str[i], face[i], &cur_face);
|
||||
putc_face (EOF, FACE_NORMAL, &cur_face);
|
||||
}
|
||||
|
||||
|
||||
@@ -6771,6 +6771,7 @@ save_parser_state (ps)
|
||||
|
||||
ps->input_line_terminator = shell_input_line_terminator;
|
||||
ps->eof_encountered = eof_encountered;
|
||||
ps->eol_lookahead = eol_ungetc_lookahead;
|
||||
|
||||
ps->prompt_string_pointer = prompt_string_pointer;
|
||||
|
||||
@@ -6836,6 +6837,7 @@ restore_parser_state (ps)
|
||||
|
||||
shell_input_line_terminator = ps->input_line_terminator;
|
||||
eof_encountered = ps->eof_encountered;
|
||||
eol_ungetc_lookahead = ps->eol_lookahead;
|
||||
|
||||
prompt_string_pointer = ps->prompt_string_pointer;
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ typedef struct _sh_parser_state_t
|
||||
/* input line state -- line number saved elsewhere */
|
||||
int input_line_terminator;
|
||||
int eof_encountered;
|
||||
int eol_lookahead;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Nothing right now for multibyte state, but might want something later. */
|
||||
|
||||
+2
-2
@@ -241,8 +241,8 @@ osf*)
|
||||
|
||||
aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com
|
||||
SHOBJ_CFLAGS=-fpic
|
||||
SHOBJ_LD='ld'
|
||||
SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
|
||||
SHOBJ_LD='${CC}'
|
||||
SHOBJ_LDFLAGS='-Wl,-bdynamic -Wl,-bnoentry -Wl,-bexpall'
|
||||
SHOBJ_XLDFLAGS='-G'
|
||||
|
||||
SHLIB_XLDFLAGS='-bM:SRE'
|
||||
|
||||
@@ -124,3 +124,61 @@ a .. .b
|
||||
a .. .b
|
||||
. .. .b
|
||||
. .. .b
|
||||
dotglob: .a .foo bar
|
||||
@(.foo)
|
||||
.foo
|
||||
!(.foo)
|
||||
.a bar
|
||||
@(.foo|*)
|
||||
.a .foo bar
|
||||
!(.foo|*)
|
||||
!(.foo|*)
|
||||
@(*)
|
||||
.a .foo bar
|
||||
!(*)
|
||||
!(*)
|
||||
.*
|
||||
. .. .a .foo
|
||||
@(.*)
|
||||
. .. .a .foo
|
||||
!(.*)
|
||||
bar
|
||||
no dotglob: .a .foo bar
|
||||
@(.foo)
|
||||
.foo
|
||||
!(.foo)
|
||||
bar
|
||||
@(.foo|*)
|
||||
.foo bar
|
||||
!(.foo|*)
|
||||
!(.foo|*)
|
||||
!(bar).foo
|
||||
!(bar).foo
|
||||
*(bar).foo
|
||||
.foo
|
||||
?(bar).foo
|
||||
.foo
|
||||
.?
|
||||
.. .a
|
||||
@(.?)
|
||||
.. .a
|
||||
!(.?)
|
||||
bar
|
||||
dotglob: .a .foo bar
|
||||
@(?|.?)
|
||||
.. .a
|
||||
@(?|.*)
|
||||
. .. .a .foo
|
||||
? .*
|
||||
? . .. .a .foo
|
||||
*
|
||||
.a .foo bar
|
||||
no dotglob: .a .foo bar
|
||||
@(?|.?)
|
||||
.. .a
|
||||
@(?|.*)
|
||||
. .. .a .foo
|
||||
? .*
|
||||
? . .. .a .foo
|
||||
*
|
||||
bar
|
||||
|
||||
+1
-5
@@ -380,15 +380,11 @@ shopt -u globstar
|
||||
builtin cd "$MYDIR"
|
||||
|
||||
${THIS_SH} ./extglob1.sub
|
||||
|
||||
${THIS_SH} ./extglob1a.sub
|
||||
|
||||
${THIS_SH} ./extglob3.sub
|
||||
|
||||
${THIS_SH} ./extglob4.sub
|
||||
|
||||
${THIS_SH} ./extglob5.sub
|
||||
|
||||
${THIS_SH} ./extglob6.sub
|
||||
${THIS_SH} ./extglob7.sub
|
||||
|
||||
exit 0
|
||||
|
||||
+25
-1
@@ -2,6 +2,30 @@ LANG=en_US.UTF-8
|
||||
|
||||
shopt -s extglob
|
||||
a="aaaäöü"
|
||||
a1=${a:3:3}
|
||||
|
||||
[[ "${a}" == "${a1}" ]] || {
|
||||
echo cond ok 1
|
||||
}
|
||||
|
||||
case "${a//?aa}" in
|
||||
"${a1}") echo ok 1;;
|
||||
*) echo bad 1;;
|
||||
esac
|
||||
|
||||
case "${a//\aaa}" in
|
||||
"${a1}") echo ok 2;;
|
||||
*) echo bad 2;;
|
||||
esac
|
||||
|
||||
case "${a//aaa}" in
|
||||
"${a1}") echo ok 3;;
|
||||
*) echo bad 3;;
|
||||
esac
|
||||
|
||||
case "${a//@(?aa)}" in
|
||||
"${a1}") echo ok 4;;
|
||||
*) echo bad 4;;
|
||||
esac
|
||||
|
||||
echo "${a}" "${a//?aa}" "${a//\aaa}"
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
: ${TMPDIR:=/tmp}
|
||||
|
||||
TESTDIR=$TMPDIR/glob-test-$$
|
||||
mkdir $TESTDIR || {
|
||||
echo "$TESTDIR: cannot create" >&2
|
||||
exit 1
|
||||
}
|
||||
cd $TESTDIR || {
|
||||
echo "$TESTDIR: cannot cd" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
shopt -s extglob dotglob
|
||||
touch .foo bar .a
|
||||
|
||||
echo dotglob: .a .foo bar
|
||||
|
||||
echo '@(.foo)'
|
||||
echo @(.foo)
|
||||
echo '!(.foo)'
|
||||
echo !(.foo)
|
||||
|
||||
echo '@(.foo|*)'
|
||||
echo @(.foo|*)
|
||||
echo '!(.foo|*)'
|
||||
echo !(.foo|*)
|
||||
|
||||
echo '@(*)'
|
||||
echo @(*)
|
||||
echo '!(*)'
|
||||
echo !(*)
|
||||
|
||||
echo '.*'
|
||||
echo .*
|
||||
echo '@(.*)'
|
||||
echo @(.*)
|
||||
echo '!(.*)'
|
||||
echo !(.*)
|
||||
|
||||
shopt -u dotglob
|
||||
|
||||
echo no dotglob: .a .foo bar
|
||||
|
||||
echo '@(.foo)'
|
||||
echo @(.foo)
|
||||
echo '!(.foo)'
|
||||
echo !(.foo)
|
||||
|
||||
echo '@(.foo|*)'
|
||||
echo @(.foo|*)
|
||||
echo '!(.foo|*)'
|
||||
echo !(.foo|*)
|
||||
|
||||
echo '!(bar).foo'
|
||||
echo !(bar).foo
|
||||
echo '*(bar).foo'
|
||||
echo *(bar).foo
|
||||
echo '?(bar).foo'
|
||||
echo ?(bar).foo
|
||||
|
||||
echo '.?'
|
||||
echo .?
|
||||
echo '@(.?)'
|
||||
echo @(.?)
|
||||
echo '!(.?)'
|
||||
echo !(.?)
|
||||
|
||||
shopt -s dotglob
|
||||
echo dotglob: .a .foo bar
|
||||
|
||||
echo '@(?|.?)'
|
||||
echo @(?|.?)
|
||||
echo '@(?|.*)'
|
||||
echo @(?|.*)
|
||||
echo '? .*'
|
||||
echo ? .*
|
||||
echo '*'
|
||||
echo *
|
||||
|
||||
shopt -u dotglob
|
||||
echo no dotglob: .a .foo bar
|
||||
|
||||
echo '@(?|.?)'
|
||||
echo @(?|.?)
|
||||
echo '@(?|.*)'
|
||||
echo @(?|.*)
|
||||
echo '? .*'
|
||||
echo ? .*
|
||||
echo '*'
|
||||
echo *
|
||||
|
||||
rm -f .a bar .foo
|
||||
|
||||
cd $OLDPWD
|
||||
rm -rf $TESTDIR
|
||||
Reference in New Issue
Block a user