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"
Have you tried the same in Windows Expect? It supports the timeout functionality. The docs list the specific differences between the versions.
The hyerlink for doc above, is not working for me? Could you send along the URL?
Thanks
It is part of the documentation that comes with ActiveTcl on Windows.
?
http://aspn.activestate.com/ASPN/docs/ActiveTcl/8.5/expect4win/ex_usage....