Reputation: 1
This is a very basic question.
I think of TCL as a command line generator. Its purpose is to generate strings for the tool’s command line interpreter. For example, the tcl commands:
set alpha “run”
$alpha
$alpha
$alpha
cause the “run” command to be sent to the tool three times – which makes sense. But:
set alpha “run”
for {set i 0} {$i<3} {incr i} $alpha
does not. So the question is: How do I send commands to the tool from inside a loop?
Upvotes: 0
Views: 65
Reputation: 10592
Here's a possible way (with output):
% proc foo {count} {
puts "count = $count"
}
% set alpha foo
foo
% for {set i 0} {$i<3} {incr i} {
$alpha $i
}
count = 0
count = 1
count = 2
%
Upvotes: 0
Reputation: 13252
Your problem is likely to be with the "funny quotes" in the line
set alpha “run”
To Tcl, those quotes aren't syntactic markers, just text. Try
set alpha "run"
or, even better,
set alpha run
Upvotes: 1