I have a very basic expect script that telnets to a switch and issue a command. The output from the device is normally very long that is why I noticed the expect output file didn't contain everything.
I did place this line exp_match_max 100000, but still it didn't help.
I am a begginer in Expect scripting so probably you might find my question a little bit silly.
Any help will be appreciated.
###########################################
This is the basic script I created (normally if the expected command output from the device is short, this type of script has no problem capturing everything).
#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}
package require Expect
# Print to console.
puts stdout "This script automatically telnets to a Nortel Passport 8600 Switch and issue show vlan info all command"
set command "show vlan info all"
set device [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set date [lindex $argv 3]
exp_match_max 10000000
# Telnet to the device using the "spawn" command.
spawn telnet $device
# Wait for a login prompt.
expect -re "Login: " {
# Login prompt received. Send user name to the device.
exp_send "$username\r"
} eof {
# No login prompt received. Display an error.
exp_send_user "could not connect\n"
}
# Wait for a password prompt from the device.
expect -re "Password: " {
# Password prompt received. Send the password.
exp_send "$password\r"
}
exp_log_file $device-$date.txt
# Wait for telnet prompt.
expect -re ".*>" {
# Enter telnet commands.
exp_send "conf cli more false\r"
}
expect -re ".*>" {
exp_send "$command\r"
}
expect -re ".*>" {
exp_send "conf cli more true\r"
}
expect -re ".*>" {
exp_send "exit\r"
}