TCLSH document

From: Radioactive Frog (pbhatkoti@gmail.com)
Date: Tue Dec 05 2006 - 10:22:44 ART


Hi Gang,
>Just want to share this document with you.
>
>At some point in your career as an administrator, it's a good bet that
>you've used a script to automate some common task. Maybe you've written
>scripts in your Linux bash shell
><http://downloads.techrepublic.com.com/5138-10877-5827301.html>
<http://downloads.techrepublic.com.com/5138-10877-5827301.html> or
with
>Windows Scripting Host (WSH)
><http://techrepublic.com.com/5100-10879_11-5746352.html>
<http://techrepublic.com.com/5100-10879_11-5746352.html>.
>
>However, up until recently, there wasn't a scripting language for Cisco
>routers; there were some available tools, but no open scripting
>language. Cisco changed this with Cisco IOS 12.3(2)T by adding the Tool
>Command Language (TCL) to the Cisco IOS. Let's take a closer look.
>
>Pronounced as "tickle," TCL is a powerful but easy way to learn dynamic
>scripting language. It's an open programming language developed by John
>Ousterhout.
>
>While the scope of this article prevents us from exploring TCL in
>detail, let's take a look at the basics of using TCL as well as some
>examples. You can find more information on TCL programming and its
>syntax by checking out its Wikipedia entry
><http://en.wikipedia.org/wiki/Tcl> <http://en.wikipedia.org/wiki/Tcl>.
>
>Before trying to use TCL on your router, make sure that you're using
>release 12.3(2)T, 12.2(25)S, or greater. To determine whether your
>router includes TCL, enter the */tclsh/* command in Global Configuration
>Mode. Here's an example:
>
>Router# **tclsh**
>
>If the router does have TCL, the prompt will look like the following:
>
>Router(tcl)#
>
>If the router doesn't include TCL, it will think you're trying to Telnet
>to a host called tclsh, and it will try to perform a DNS lookup on that
>host.
>
>Once you're at the IOS TCL prompt, enter the */tclq/* command to exit, as
>shown below:
>
>Router(tcl)# **tclq**
>Router#
>
>Now, let's look at some examples of using TCL. To run a User EXEC Mode
>command on a Cisco router, you would begin each command with */exec/* and
>place the actual command in quotes. Here's an example:
>
>Router(tcl)# exec "show version"
>
>To use a Global Configuration Mode command, begin the command with
>*/ios_config/**. *Then, put the Global Configuration Mode command in
>quotes, following with the sub-command in quotes. Don't forget that you
>must put the command and sub-commands on the same TCL command line, or
>they won't work. Here's an example:
>
>Router(tcl)# ios_config "interface serial0/0" "ip address 1.1.1.1 255.0.0.0"
>
>These are two simple examples of using TCL with a single command. But
>once you've learned the TCL scripting language, you can write much more
>complex scripts.
>
>For example, you could write a script to ping a list of IP addresses, or
>you could write one to filter output from commands and format it to your
>liking. You could even write a script to send an e-mail message from a
>router.
>
>Once you understand the basics of TCL in the IOS, you'll quickly find
>that it's easier to edit TCL scripts on the desktop and transfer them to
>the router with a TFTP server (such as tftpd32.exe
><http://tftpd32.jounin.net/> <http://tftpd32.jounin.net/>), rather
than manually entering scripts at
>the router.
>
>TCL on Cisco IOS routers is a relatively new feature, but this feature
>will likely grow in popularity over time as admins become more familiar
>with it. For more information, check out the Cisco IOS Scripting with
>Tcl documentation
><http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_feature_guide09186a00801a75a7.html>
<http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_feature_guide09186a00801a75a7.html>.
>
>Cheers!
Frog.



This archive was generated by hypermail 2.1.4 : Tue Jan 02 2007 - 07:50:36 ART