K3NN3TH
K3NN3TH

Reputation: 1496

can expect be told not to timeout without explicitly setting a huge constant value?

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"

Upvotes: 2

Views: 3673

Answers (1)

Inian
Inian

Reputation: 85600

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.

Upvotes: 9

Related Questions