problem with for each
 
Post new topic   Reply to topic    Hawkee.com Forum Index -> TCL Scripting
 
mgdtcl  -  Tue May 10, 2011 2:31 pm Reply with quote
I am trying to use an embedded for each statement on a Cicso router using its tclsh scripting language. I want to ping multiple sites and display the site name before the ping statements. Here is the error I get when I issue the command:

Victoria-GW#tclsh flash:ping_test.tcl
wrong # args: should be "foreach varList list ?varList list ...? command"
while executing
"foreach site {
one
two
three}"
(file "flash:ping_test.tcl" line 2)

Here is my script:

tclsh
foreach site {
one
two
three}
address {
172.22.240.1
172.22.248.9
172.22.248.15
} { puts "Pinging $site\n"
ping $address
}
Display posts from previous:   
Post new topic   Reply to topic    Hawkee.com Forum Index -> TCL Scripting All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.