eval
command takes a string argument which is a command, as follows:
% set cmd {puts stdout "Hello, World!"}
puts stdout "Hello, World!"
% eval $cmd
Hello, World!
The subst
command does the single round of
substitution ordinarily completed by the interpreter, but without
invoking any command. It takes one argument, the string to be
substituted into.
% set a "foo bar"
foo bar
% subst {a=$a date=[exec date]}
a=foo bar date=Thu Feb 30 1:11:11 EST 1901
While curly braces normally prevent internal substitution, they are
not respected by the subst
command. In order to prevent
the single round of substitution, the backslash must be used before
special characters like a dollar sign or square brackets.
exec
.