Config Replace with Expect

Can anyone help me with an expect script?

I want to be able to have my expect script run the command config replace unix:r11.cfg, but I can't seem to get it to work.


#! /usr/bin/expect


spawn telnet localhost 2011
expect {
"telnet: Unable to connect" continue
connected }
expect {
"Would you like to" {send "03"; send "
"; send "
"}
"Press RETURN to get started" {send "
"}
exit
}
send "
"
send "enable
"
expect "#"
send "
"
send "config replace unix:r11.cfg
"
expect {
"\[no\]:" {send "y
"}
"Over*" {send "y
"}
exp_continue
}
send "wr
"
send "x1d"
expect "telnet>"
send "q
"
Sign In or Register to comment.