I can't seem to modify the tclsh script I use for Cisco to test basic ping reachability on my Mac OSX.
I swap the ping to ping -c 2 $ip.
Can anyone help solve this?
Thanks.
proc PI {} {
foreach ip {
155.1.45.5
155.1.0.3
} { exec [ping $ip timeout 1 r 2 ] }
}
The basic fix to your code is to drop those
[brackets]; brackets in Tcl are like`in the Unix shell. (But nestable.)You want the
pingto be run by a sub-process, so you want to pass the namepingtoexec, which runs sub-processes.You might also need to consider what to do with the results from the ping. Right now, you'll get an error if anything is unreachable. (Also be aware that the syntax of ping varies between systems; using it isn't very portable…)