Command substitution happens when a word contains an open square bracket, `['. The string between the open bracket and matching closing bracket are treated as a Tcl script. The script is evaluated and its result is substituted in place of the original command substitution word.
A simple example of command substitution is:
set a 1 set b [set a]
which does the same as the previous example but using command
substitution. The result of a set a
command is to return the
value of a
, which is then passed as an argument to
set b
and so variable b
acquires the value of variable
a
.