new shell option to force globbing never to return .' and ..' as matches

This commit is contained in:
Chet Ramey
2022-01-04 10:11:48 -05:00
parent 701f36c2c3
commit 186129835e
21 changed files with 230 additions and 32 deletions
+21 -3
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Mon Nov 22 09:58:49 EST 2021
.\" Last Change: Sun Dec 26 16:02:07 EST 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 November 22" "GNU Bash 5.2"
.TH BASH 1 "2021 December 26" "GNU Bash 5.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -714,7 +714,7 @@ Expressions are composed of the primaries described below under
.SM
.BR "CONDITIONAL EXPRESSIONS" .
The words between the \fB[[\fP and \fB]]\fP do not undergo word splitting
and filename expansion.
and pathname expansion.
The shell performs tilde expansion, parameter and
variable expansion, arithmetic expansion, command substitution, process
substitution, and quote removal on those words
@@ -3742,6 +3742,14 @@ the pattern must begin with ``.'' (for example, ``.?''),
even if
.B dotglob
is set.
If the
.B globskipdots
shell option is enabled, the filenames
.B ``.''
and
.BR ``..''
are never matched, even if the pattern begins with a
.BR ``.'' .
When not matching pathnames, the
.B ``.''
character is not treated specially.
@@ -3759,6 +3767,7 @@ below under
for a description of the
.BR nocaseglob ,
.BR nullglob ,
.BR globskipdots ,
.BR failglob ,
and
.B dotglob
@@ -10361,6 +10370,15 @@ and
.BR B ,
and upper-case and lower-case ASCII characters will collate together.
.TP 8
.B globskipdots
If set, pathname expansion will never match the filenames
.B ``.''
and
.BR ``..'' ,
even if the pattern begins with a
.BR ``.'' .
This option is enabled by default.
.TP 8
.B globstar
If set, the pattern \fB**\fP used in a pathname expansion context will
match all files and zero or more directories and subdirectories.
+10
View File
@@ -2757,6 +2757,9 @@ must be matched explicitly, unless the shell option @code{dotglob} is set.
In order to match the filenames @samp{.} and @samp{..},
the pattern must begin with @samp{.} (for example, @samp{.?}),
even if @code{dotglob} is set.
If the @code{globskipdots} shell option is enabled, the filenames
@samp{.} and @samp{..} are never matched, even if the pattern begins
with a @samp{.}.
When not matching filenames, the @samp{.} character is not treated specially.
When matching a filename, the slash character must always be
@@ -2766,6 +2769,7 @@ below (@pxref{Pattern Matching}).
See the description of @code{shopt} in @ref{The Shopt Builtin},
for a description of the @code{nocaseglob}, @code{nullglob},
@code{globskipdots},
@code{failglob}, and @code{dotglob} options.
The @env{GLOBIGNORE}
@@ -5692,6 +5696,12 @@ is not taken into account, so
@samp{b} will not collate between @samp{A} and @samp{B},
and upper-case and lower-case ASCII characters will collate together.
@item globskipdots
If set, filename expansion will never match the filenames
@samp{.} and @samp{..},
even if the pattern begins with a @samp{.}.
This option is enabled by default.
@item globstar
If set, the pattern @samp{**} used in a filename expansion context will
match all files and zero or more directories and subdirectories.
+2 -2
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2021 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Dec 2 15:07:19 EST 2021
@set LASTCHANGE Sun Dec 26 16:02:48 EST 2021
@set EDITION 5.2
@set VERSION 5.2
@set UPDATED 2 December 2021
@set UPDATED 26 December 2021
@set UPDATED-MONTH December 2021