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. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Router not taking commands through TCL

Hi

Following is the TCL script i wrote to log show commands wonder why i couldnt see the output. Please let me know if there are any changes to be done.

package require Expect

spawn telnet 10.1.2.12

expect "Username:"

exp_send  "user\r"

expect "Password:"

exp_send "pass\r"

expect ">"

exp_send "en 4\r"

expect "Password:"

exp_send "pass\r"

expect -re "#"

set filename "tcloutput.txt"

sleep {2}

exp_log_file -a $filename

exp_send "show clock "

sleep {2}

exp_send "show ip interface brief "

sleep {2}

exp_log_file

  • EEM Scripting
Everyone's tags (2)
3 REPLIES
Cisco Employee

Router not taking commands through TCL

On your last line, try:

puts $expect_out(buffer)

New Member

Re: Router not taking commands through TCL

Hi Joseph,

Tried the command but no change in the output.

As per my understanding commands are getting executed on router but i am unable to log that output to file. Could any one help me out if i have to make any changes on loggin the output.

Cisco Employee

Re: Router not taking commands through TCL

I had assumed you just weren't seeing the output from the script.  Now I have no idea what symptoms you're seeing.  Since you haven't provided enough details, the best I can offer is the attached Expect script I have used to grab output from a device.  Perhaps you can adapt it to suit your needs.

506
Views
0
Helpful
3
Replies