Search This Blog & Internet

Showing posts with label TCL. Show all posts
Showing posts with label TCL. Show all posts

Wednesday, April 27, 2011

TCL within CiscoWorks

I wrote the following script which shut down the unused interfaces (status "down") on Catalyst 2960. When I copied and pasted the script via SSH, it was working fine without any error message, but when I executed it via CiscoWorks (RME 4.3.1) the job failed with the following error message:

tclsh
Switch(tcl)#
for {set x 0} {$x<24} {incr x} {
missing  close-brace
Switch(tcl)#
set etat [string range [lrange [exec sh ip int  brief | i FastEthernet0/$x] 4 4] 0 4 ]
can't read "x": no such variable 
Switch(tcl)#
if { [string equal $etat "down"] } {
missing close-brace 
Switch(tcl)#
puts [ios_config "Interface FastEthernet0/$x"  "shut"]
can't read "x": no such variable
Switch(tcl)#
}
invalid  command name "}"
}
^
% Invalid input detected at '^' marker.

Switch(tcl)#
}
invalid command name "}"
}
^
% Invalid  input detected at '^' marker.