# #tclsh (tcl)#proc get_bri {} { ;Create a process called get_bri without arguments, if arguments needed, specify them inside the braces as names. Leave a space between braces and opening program brace (tcl)#ios_config "interface GigabitEthernet 1/10" "no keepalive" ;This runs a iOS command: "interface GigabitEthernet 1/10" to go to that interface and then the subcommand "no keepalive" to disable the keepalive feature. These two commands must be in the same line and cannot go in different lines or this won't work. (tcl)#exec "show interfaces" ;This makes possible to send an exec command tcl)#} ; Closes main program. After closing it, check that there are no errors or warnings or the program will not run (tcl)#get_bri ; To run the function, run it on tcl or it won't run (tcl)#tclquit ; Quits TCL script # Example SW4948-1.H264(tcl)#proc tests {a} { +>puts "hello world" +>puts $a +>} SW4948-1.H264(tcl)#tests {10} hello world 10 Other Examples: https://rekrowten.wordpress.com/2011/11/18/small-scripts-in-tcl/ # Loop # Run specified command in a loop for X times and wait Y ms after every execution. set repeat 10; set command "show ip interface brief"; set wait 1000; for { set i 1 } { $i <= $repeat } { incr i } { puts "\n===========================\nShowing: $i/$repeat\n===========================" $command after $wait } set repeat 10 set command "show ip interface brief" set wait 1000 for { set i 1 } { $i <= $repeat } { incr i } { puts "\n===========================\nShowing: $i/$repeat\n===========================" $command after $wait }