diff options
Diffstat (limited to 'doc/subst.n')
-rw-r--r-- | doc/subst.n | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/doc/subst.n b/doc/subst.n index 4518140..07f0933 100644 --- a/doc/subst.n +++ b/doc/subst.n @@ -5,7 +5,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH subst n 7.4 Tcl "Tcl Built-In Commands" .so man.macros .BS @@ -33,7 +33,7 @@ For example, if \fB\-nocommands\fR is specified, command substitution is not performed: open and close brackets are treated as ordinary characters with no special interpretation. .PP -Note that the substitution of one kind can include substitution of +Note that the substitution of one kind can include substitution of other kinds. For example, even when the \fB\-novariables\fR option is specified, command substitution is performed without restriction. This means that any variable substitution necessary to complete the @@ -62,23 +62,19 @@ itself will either return an error, or will complete successfully. When it performs its substitutions, \fIsubst\fR does not give any special treatment to double quotes or curly braces (except within command substitutions) so the script -.PP .CS set a 44 \fBsubst\fR {xyz {$a}} .CE -.PP returns .QW "\fBxyz {44}\fR" , not .QW "\fBxyz {$a}\fR" and the script -.PP .CS set a "p\e} q \e{r" \fBsubst\fR {xyz {$a}} .CE -.PP returns .QW "\fBxyz {p} q {r}\fR" , not @@ -86,12 +82,10 @@ not .PP When command substitution is performed, it includes any variable substitution necessary to evaluate the script. -.PP .CS set a 44 \fBsubst\fR -novariables {$a [format $a]} .CE -.PP returns .QW "\fB$a 44\fR" , not @@ -99,13 +93,11 @@ not Similarly, when variable substitution is performed, it includes any command substitution necessary to retrieve the value of the variable. -.PP .CS proc b {} {return c} array set a {c c [b] tricky} \fBsubst\fR -nocommands {[b] $a([b])} .CE -.PP returns .QW "\fB[b] c\fR" , not @@ -115,42 +107,34 @@ The continue and break exceptions allow command substitutions to prevent substitution of the rest of the command substitution and the rest of \fIstring\fR respectively, giving script authors more options when processing text using \fIsubst\fR. For example, the script -.PP .CS \fBsubst\fR {abc,[break],def} .CE -.PP returns .QW \fBabc,\fR , not .QW \fBabc,,def\fR and the script -.PP .CS \fBsubst\fR {abc,[continue;expr {1+2}],def} .CE -.PP returns .QW \fBabc,,def\fR , not .QW \fBabc,3,def\fR . .PP Other exceptional return codes substitute the returned value -.PP .CS \fBsubst\fR {abc,[return foo;expr {1+2}],def} .CE -.PP returns .QW \fBabc,foo,def\fR , not .QW \fBabc,3,def\fR and -.PP .CS \fBsubst\fR {abc,[return -code 10 foo;expr {1+2}],def} .CE -.PP also returns .QW \fBabc,foo,def\fR , not @@ -158,7 +142,4 @@ not .SH "SEE ALSO" Tcl(n), eval(n), break(n), continue(n) .SH KEYWORDS -backslash substitution, command substitution, quoting, substitution, variable substitution -.\" Local Variables: -.\" mode: nroff -.\" End: +backslash substitution, command substitution, variable substitution |