Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

A little help getting started please

I have been coding massive amounts of TCL scripts for IOS and frankly, now that I'm comfortable with TCL as a language I want to make the next move. I have not been able to find a good starting point just yet to make the jump.

I am currently waiting for a copy of the Cisco TCL programmer guide (found a used one) to show up in the mail, but this will take nearly a month.

Can someone take the following script :

  foreach a [ list 6 7 8 9 79 80 81 82 83 84 85 86 87 ] {

  clear line $a

}

And help me convert this so that if I type :

host# clearlab

on the CLI, it will trigger the script and for each "[confirm]" message that shows up, it sends a carriage return.

So far, I have found that I need to register an EEM event (not so hard) and I'll need to import the Cisco libraries. I believe I'll need to also save this to flash using puts [ open...

Any help would be immensly appreciated!

Everyone's tags (2)
5 REPLIES
Cisco Employee

A little help getting started please

What is the event you want to use to trigger the clear line?

New Member

A little help getting started please

Joseph,

Thanks for the response.

As mentioned above... I'd like to make use of the CLI event of a user typing clearlab

Cisco Employee

A little help getting started please

You could do an applet like:

event manager environment vty_lines 6 7 8 9 79 80 81 82 83 84 85 86 87

event manager applet clear-vtys

event cli pattern "^clearlab" enter

action 000 cli command "enable"

action 001 foreach a $vty_lines

action 002  cli command "clear line $a" pattern "confirm"

action 003  cli command "y"

action 004 end

New Member

A little help getting started please

Certainly! But it wouldn't help me to learn how to properly trigger TCL scripts from the command line

I only recommended that particular example randomly. I actually plan to use it as a template to hopefully do much grander things

Thanks a lot for this one though, it is also going into my library under "sometimes simple tasks are best done simple"

Cisco Employee

A little help getting started please

You can take that applet to http://www.marcuscom.com/convert_applet to get the EEM Tcl version.  The results from that site can give you an EEM Tcl policy that you can register and trigger using the same clearlab command.

458
Views
0
Helpful
5
Replies
CreatePlease login to create content