From: Peter Avalos Date: Sun, 21 Aug 2011 22:07:23 +0000 (-0700) Subject: sh(1): Improve documentation of shell patterns: X-Git-Tag: v2.12.0~140 X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/2fbd2f096aa888a38a58434b932565952c2169a1 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. Obtained-from: FreeBSD 223522 --- diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index add56f1915..0fbab34883 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -34,7 +34,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 -.\" $FreeBSD: src/bin/sh/sh.1,v 1.172 2011/06/24 20:23:50 jilles Exp $ +.\" $FreeBSD: src/bin/sh/sh.1,v 1.173 2011/06/24 22:08:26 jilles Exp $ .\" .Dd August 21, 2011 .Dt SH 1 @@ -1640,15 +1640,15 @@ There are two restrictions on this: first, a pattern cannot match a string containing a slash, and second, a pattern cannot match a string starting with a period unless the first character of the pattern is a period. -The next section describes the patterns used for both -Pathname Expansion and the +The next section describes the patterns used for +Pathname Expansion, +the four varieties of parameter expansion for substring processing and the .Ic case command. .Ss Shell Patterns A pattern consists of normal characters, which match themselves, and meta-characters. The meta-characters are -.Ql \&! , .Ql * , .Ql \&? , and @@ -1678,7 +1678,7 @@ matches a .Ql \&[ rather than introducing a character class. 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 .Xr wctype 3 ) may be specified by surrounding the name with @@ -1690,9 +1690,10 @@ For example, is a shell pattern that matches a single letter. The character class may be complemented by making an exclamation point .Pq Ql !\& -or the caret -.Pq Ql ^\& the first character of the character class. +A caret +.Pq Ql ^ +has the same effect but is non-standard. .Pp To include a .Ql \&] @@ -1700,7 +1701,7 @@ in a character class, make it the first character listed (after the .Ql \&! or -.Ql \&^ , +.Ql ^ , if any). To include a .Ql - ,