cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
955
Views
5
Helpful
1
Replies

Simple TCL reference for IOS routers?

blakem
Beginner
Beginner

Hi,

Does anyone know of a simple TCL reference for scripting IOS routers?

I've had a look at http://www.cisco.com/en/US/products/sw/voicesw/ps2192/products_programming_reference_guide_book09186a00800de1de.html

and

http://www.cisco.com/univercd/cc/td/doc/product/software/ios123/123newft/123t/123t_2/gt_tcl.htm

but the first is aimed at voice functions, and the second is very basic..

I'd like to learn how to work with the IOS filesystem (for tasks like copying, renaming, listing etc).

Many thanks,

Michael

1 Reply 1

Joe Clarke
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee

The second is pretty much as detailed as it gets for IOS TCL scripting. But for file system manipulation, all of the standard TCL 8.3 code procedures will work (except for those listed athttp://www.cisco.com/univercd/cc/td/doc/product/software/ios123/123newft/123t/123t_2/gt_tcl.htm#wp1027175 ). We did not add any TCL extensions for dealing with files. For example, copying a file to a TFTP server is as easy as:

exec "copy flash:myfile tftp://10.1.1.1/myfile"

If you need to open and read a file:

set fd [open "flash:/myfile" "r"]

while { ! [eof $fd] } {

set line [read -nonewline $fd]

puts $line

}

close $fd

So any general TCL scripting guide will do. Just remember that the underlying CLI toolchain is IOS EXEC; so every command you can run from the CLI, you can also run via TCL's exec procedure.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers