cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1788
Views
0
Helpful
3
Replies

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

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

On your last line, try:

puts $expect_out(buffer)

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.

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.

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: