For example, if you do like to implement a comfortable Tcl-based pinger, store the following Tcl code into the file flash:pinger.tcl ...
proc pinger { iplist } {
foreach ip $iplist {
if { [regexp "(!!!)" [exec "ping $ip timeout 1" ]] } {
puts "$ip"
} else { puts "$ip **** failed ***" }
}
}
... and configure scripting tcl init flash:pinger.tcl.
Now you can ping a number of hosts in a single operation:
R1#tclsh
R1(tcl)#pinger { 10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4 }
10.0.0.1
10.0.0.2
10.0.0.3 **** failed ***
10.0.0.4 **** failed **
Or as TCL Script for individual use.
foreach ip {
1.1.1.1
2.2.2.2
} {
if { [regexp "(!!!)" [exec "ping $ip timeout 1" ]] } {
puts "$ip"
} else { puts "$ip **** failed ***" }
}