• Uncategorized

About expect : can-expect-be-told-not-to-timeout-without-explicitly-setting-a-huge-constant-value

Question Detail

I’ve set the timeout to a stupid high number. Is there a better way to tell the script not to time out?

#!/usr/bin/expect
spawn telnet 10.10.10.10
set timeout 200000000
expect "login"
send "user\r"
expect "Password:"
send "password\r"
send "./run/this.sh\r"

Question Answer

Set the timeout value to -1

set timeout -1

An excerpt from the expect, man page

If no timeout keyword is used, an implicit null action is executed upon timeout. The default timeout period is 10 seconds but may be set, for example to 30, by the command “set timeout 30”. An infinite timeout may be designated by the value -1.

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.