09-01-2013 04:40 AM
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
09-01-2013 09:09 AM
On your last line, try:
puts $expect_out(buffer)
09-01-2013 07:48 PM
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.
09-01-2013 09:07 PM
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.
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: