cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
27041
Views
15
Helpful
18
Replies

Help with TCL scripts to do show commands

gwhuang5398
Level 2
Level 2

I need to log into about 60 routers, run the same show commands on each router, and copy each router's outputs as a file on my workstation. Can someone provide a sample TCP script to do those things? I'm not good at programming.

Greatly appreciated.

18 Replies 18

Rut ro  

I AM using AAA.

I'm assuming I should change this:

expect -re ".*assword:" {
exp_send "$pass\r"
}

to this:

expect -re ".*sername:" {
exp_send "$user\r"
}


expect -re ".*assword:" {
exp_send "$pass\r"
}

How far off am I?

PS - TY for your help!  The engineers at work tell me I don't need to know Tcl [except to take the CCIE lab (bwhahahaha!)] but I've never learned scripting/programming/coding at all... and it's always intrigued me...

I always said I'd marry a man JUST because he knows how to write scripts

~Kathy

Assuming you have a $user variable with the correct username, then yes your proposal should work.  That said, things will fail when you move to enable mode unless you set your $prompt variable to:

"\[>#]"

That is:

set prompt "\[>#]"

Enable mode?

Uhhhh.....que?

Kidding.

No, I'm the intern.

I have level 1 "n00b" access.

I had level 15 access the second day, for a special project. (I wrote a VACL!  Wooot!)

It scared the CRAP out of me.

I did a show mac-address yada yada and it just kept going and going and going...

All those poor employees! 

...they had *NO IDEA* how close they were to having their desktops instanteously combust

And Cisco is going to be supplying POWER to the cube, now?

With people like *ME* responsible for getting it there?

Bwahahahahahahahahahahahaha!!!!

TY for the heads up.

I'm gonna try it tomorrow...

(crosses fingers...)

~Kathy

Scott....

Being a temporary intern, I have been busy doing this n' that....

http://media.avclub.com/images/products/productgroup/240/B-FillThisIntern_400x400_1_jpg_400x400_upscale_q85.jpg

...but I've been looking forward to playing around with Tcl...

That is....

....until....

...I opened your cmd-win32.tcl.zip...

I read it.

I read it again.

I'm not sure, but I think I need medical attention.

I mean...that literally HURT my brain...

I never learned any programming languages...

The last time I tinkered with anything was (wait for it...) about 5 or 10 lines of BASIC (which was stored on a cassette tape hooked to a Trash-80...)

I CAN do HTML and played with CSS, which Tcl kinda reminds me of, but man oh man.... am I gonna need a stiff bottle of scotch and a computer I don't mind mistakenly formatting c:\ after 1 shot of scotch (I'm small...)

(I did "copy bs: flash:" very late one night [at 1:30am]... ask me how THAT went...)

Anyhoo...I'm gonna modify your script as per Gary's questions (b/c I literally am running the same environment, 'cept his DIR path ain't the same ) and see how it goes...

If I need you to help me XMODEM, we know things didn't go so goog....

~Spamster

Review Cisco Networking for a $25 gift card