Sé que la mayoría de vosotros ya conocéis esta función. Yo la he necesitado hoy pero no recordaba exactamente cómo era así que he tenido que repasar algo de información. Como no quiero volver a olvidarlo ni tener que navegar por la web para encontrarlo creo este post.

Aquí está el script para probar la accesibilidad a algunos/muchos/varios dispositivos sin necesidad de insertar el mismo comando una vez, dos veces y así sucesivamente…

tclsh  
 foreach ip {  
 10.210.141.99  
 10.210.141.100  
 10.210.141.101  
 10.210.141.102  
 10.210.141.103  
 10.210.141.104  
 10.210.141.105  
 10.210.141.106  
 10.210.141.107  
 10.210.141.108  
 10.210.141.110  
 10.210.141.112  
 10.210.141.114  
 10.210.141.116  
 10.210.141.118  
 10.210.141.119  
 10.210.141.120  
 10.210.141.121  
 10.210.141.122  
} {ping $ip}

Y el resultado:

SW(tcl)#foreach ip {  
 +>10.210.141.99  
 +>10.210.141.100  
 +>10.210.141.101  
 +>10.210.141.102  
 +>10.210.141.103  
 +>10.210.141.104  
 +>10.210.141.105  
 +>10.210.141.106  
 +>10.210.141.107  
 +>10.210.141.108  
 +>10.210.141.110  
 +>10.210.141.112  
 +>10.210.141.114  
 +>10.210.141.116  
 +>10.210.141.118  
 +>10.210.141.119  
 +>10.210.141.120  
 +>10.210.141.121  
 +>10.210.141.122  
 +>} {ping $ip}  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.99, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/8/16 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.100, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/8 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.101, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/7/16 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.102, timeout is 2 seconds:  …..  
 Success rate is 0 percent (0/5)  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.103, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/8/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.104, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/10/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.105, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.106, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.107, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.108, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/16 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.110, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.112, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/15/50 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.114, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.116, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.118, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.119, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.120, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/7/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.121, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.122, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/9 ms  
 SW(tcl)#

Sólo recuerde salir de tcl prompt para poder seguir trabajando con su dispositivo.

P.D. Lo sé, lo sé, el 102 sigue caído…