sh: Document the expansion changes in the man page.

Note that the following sentence
> Enclosing the full parameter expansion string in double-quotes does not
> cause the following four varieties of pattern characters to be quoted,
> whereas quoting characters within the braces has this effect.
is now true, but used to be incorrect.
This commit is contained in:
Jilles Tjoelker 2010-04-04 13:17:05 +00:00
parent 0b25da7e0b
commit 227c8e2a66

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd March 6, 2010
.Dd April 4, 2010
.Dt SH 1
.Os
.Sh NAME
@ -1178,10 +1178,20 @@ consists of all characters until the matching
.Ql } .
Any
.Ql }
escaped by a backslash or within a quoted string, and characters in
escaped by a backslash or within a single-quoted string, and characters in
embedded arithmetic expansions, command substitutions, and variable
expansions, are not examined in determining the matching
.Ql } .
Except for the variants with
.Ql + ,
.Ql - ,
.Ql =
or
.Ql ?\& ,
any
.Ql }
within a double-quoted string is also not examined in determining the matching
.Ql } .
.Pp
The simplest form for parameter expansion is:
.Pp
@ -1265,6 +1275,14 @@ is substituted.
In the parameter expansions shown previously, use of the colon in the
format results in a test for a parameter that is unset or null; omission
of the colon results in a test for a parameter that is only unset.
.Pp
The
.Ar word
inherits the type of quoting
(unquoted, double-quoted or here-document)
from the surroundings,
with the exception that a backslash that quotes a closing brace is removed
during quote removal.
.Bl -tag -width indent
.It Li ${# Ns Ar parameter Ns Li }
String Length.