Arjen Markus (12 november 2003) In response to a recent discussion on the c.l.t. about a problem that arose in the context of regular expressions, I have started this page. Its sole purpose: document dangerous constructs in Tcl
Using the subst command on arbitrary data:
set a "Hello," set b "world!" set string "$a $b" puts [substr $string]
gives:
Hello, world!
but:
set string "\[exit\]" puts [subst $string]
stops you program!
The subst command allows you to suppress the execution of commands:
puts [subst -nocommands $string]
gives:
[exit]
Please: the next!