can expect be told not to timeout without explicit

2019-09-14 20:40发布

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"

标签: expect
1条回答
Rolldiameter
2楼-- · 2019-09-14 21:16

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.

查看更多
登录 后发表回答