I am using ActiveState 8.4.16.0, I have found this code format that seems to work great:
expect "Login:"
send "root\r"
expect ">"
send "ksh\r"
expect "#*"
send "tar -xvf /dev/rmt/0m\r"
expect "#"
My question is, how do I set it up to fail out if one of the expect calls
doesn't happen? In UX it would be aomething like:
proc T1 {} {
set EXITCODE [format "NO root prompt\n" ]
send_user $EXITCODE
exit -1
}
set timeout 5
expect {#*} {send "root\r"} \
timeout {T1}
If "#" wasn't found in 5 seconds, the program would fail and the log would report "NO root prompt"