Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail

 

The tclsh is a simple command-line interactive interpreter.

Let’s start with an example, after the network has been setup, its is necessary to ping all the host through out the network, you can use following script to ping them once for all, instead of wait for a couple of seconds after one ping command and then issue another command.

router# tclsh
foreach address {
10.0.0.1
10.0.0.2
10.1.1.1
172.16.0.1
172.16.0.2
172.16.1.1
192.168.0.1
192.168.1.1
} {
ping $address }

 

simply issue tclsh, then press enter.

then Type “foreach address { 10.0.0.1 10.0.0.2 10.1.1.1 172.16.0.1 172.16.0.2 172.16.1.1 192.168.0.1 192.168.1.1 } { ping $address }” in one line and press enter.

 

Reference

https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html