sh(1): Improve documentation of shell patterns:
* Shell patterns are also for ${var#pat} and the like. * An '!' by itself will not trigger pathname generation so do not call it a meta-character, even though it has a special meaning directly after an '['. * Character ranges are locale-dependent. * A '^' will complement a character class like '!' but is non-standard. MFC after: 1 week
This commit is contained in:
parent
9c916c627f
commit
519c4ef391
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223522
15
bin/sh/sh.1
15
bin/sh/sh.1
@ -1629,15 +1629,15 @@ There are two restrictions on this: first, a pattern cannot match
|
|||||||
a string containing a slash, and second,
|
a string containing a slash, and second,
|
||||||
a pattern cannot match a string starting with a period
|
a pattern cannot match a string starting with a period
|
||||||
unless the first character of the pattern is a period.
|
unless the first character of the pattern is a period.
|
||||||
The next section describes the patterns used for both
|
The next section describes the patterns used for
|
||||||
Pathname Expansion and the
|
Pathname Expansion,
|
||||||
|
the four varieties of parameter expansion for substring processing and the
|
||||||
.Ic case
|
.Ic case
|
||||||
command.
|
command.
|
||||||
.Ss Shell Patterns
|
.Ss Shell Patterns
|
||||||
A pattern consists of normal characters, which match themselves,
|
A pattern consists of normal characters, which match themselves,
|
||||||
and meta-characters.
|
and meta-characters.
|
||||||
The meta-characters are
|
The meta-characters are
|
||||||
.Ql \&! ,
|
|
||||||
.Ql * ,
|
.Ql * ,
|
||||||
.Ql \&? ,
|
.Ql \&? ,
|
||||||
and
|
and
|
||||||
@ -1667,7 +1667,7 @@ matches a
|
|||||||
.Ql \&[
|
.Ql \&[
|
||||||
rather than introducing a character class.
|
rather than introducing a character class.
|
||||||
A character class matches any of the characters between the square brackets.
|
A character class matches any of the characters between the square brackets.
|
||||||
A range of characters may be specified using a minus sign.
|
A locale-dependent range of characters may be specified using a minus sign.
|
||||||
A named class of characters (see
|
A named class of characters (see
|
||||||
.Xr wctype 3 )
|
.Xr wctype 3 )
|
||||||
may be specified by surrounding the name with
|
may be specified by surrounding the name with
|
||||||
@ -1680,12 +1680,17 @@ is a shell pattern that matches a single letter.
|
|||||||
The character class may be complemented by making an exclamation point
|
The character class may be complemented by making an exclamation point
|
||||||
.Pq Ql !\&
|
.Pq Ql !\&
|
||||||
the first character of the character class.
|
the first character of the character class.
|
||||||
|
A caret
|
||||||
|
.Pq Ql ^
|
||||||
|
has the same effect but is non-standard.
|
||||||
.Pp
|
.Pp
|
||||||
To include a
|
To include a
|
||||||
.Ql \&]
|
.Ql \&]
|
||||||
in a character class, make it the first character listed
|
in a character class, make it the first character listed
|
||||||
(after the
|
(after the
|
||||||
.Ql \&! ,
|
.Ql \&!
|
||||||
|
or
|
||||||
|
.Ql ^ ,
|
||||||
if any).
|
if any).
|
||||||
To include a
|
To include a
|
||||||
.Ql - ,
|
.Ql - ,
|
||||||
|
Loading…
Reference in New Issue
Block a user