Logging this here for easy fetching later.
#!/usr/bin/expect
set timeout 30
spawn ssh USERNAME@HOSTNAME
expect_after eof { exit 0 }
## interact with SSH
expect {
"yes/no" { send "yes\r" }
-re ".assword:" { send "PASSWORD\r" }
}
expect "> " { send "showconfig\r" }
expect "> " { send "Y\r" }
expect "Press Any Key For More" { send "\r" }
set timeout 2
while 1 {
expect {
"Press Any Key For More" { send "\r" }
timeout break
}
}
expect "> " { send "exit\r" }
Testing this thing out, leaving a comment from my Yahoo OpenId account.