1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1994 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: subst.n,v 1.1.1.1 2002-01-16 10:25:25 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH subst n 7.4 Tcl "Tcl Built-In Commands"
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
subst \- Perform backslash, command, and variable substitutions
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBsubst \fR?\fB\-nobackslashes\fR? ?\fB\-nocommands\fR? ?\fB\-novariables\fR? \fIstring\fR
|
18 |
|
|
.BE
|
19 |
|
|
|
20 |
|
|
.SH DESCRIPTION
|
21 |
|
|
.PP
|
22 |
|
|
This command performs variable substitutions, command substitutions,
|
23 |
|
|
and backslash substitutions on its \fIstring\fR argument and
|
24 |
|
|
returns the fully-substituted result.
|
25 |
|
|
The substitutions are performed in exactly the same way as for
|
26 |
|
|
Tcl commands.
|
27 |
|
|
As a result, the \fIstring\fR argument is actually substituted twice,
|
28 |
|
|
once by the Tcl parser in the usual fashion for Tcl commands, and
|
29 |
|
|
again by the \fIsubst\fR command.
|
30 |
|
|
.PP
|
31 |
|
|
If any of the \fB\-nobackslashes\fR, \fB\-nocommands\fR, or
|
32 |
|
|
\fB\-novariables\fR are specified, then the corresponding substitutions
|
33 |
|
|
are not performed.
|
34 |
|
|
For example, if \fB\-nocommands\fR is specified, no command substitution
|
35 |
|
|
is performed: open and close brackets are treated as ordinary characters
|
36 |
|
|
with no special interpretation.
|
37 |
|
|
.PP
|
38 |
|
|
Note: when it performs its substitutions, \fIsubst\fR does not
|
39 |
|
|
give any special treatment to double quotes or curly braces. For
|
40 |
|
|
example, the script
|
41 |
|
|
.CS
|
42 |
|
|
\fBset a 44
|
43 |
|
|
subst {xyz {$a}}\fR
|
44 |
|
|
.CE
|
45 |
|
|
returns ``\fBxyz {44}\fR'', not ``\fBxyz {$a}\fR''.
|
46 |
|
|
|
47 |
|
|
.SH KEYWORDS
|
48 |
|
|
backslash substitution, command substitution, variable substitution
|