可以期望在没有明确设置一个巨大的常量值的情况下被告知不要超时吗?

K3N*_*3TH 2 expect

我已将超时设置为一个愚蠢的高数。有没有更好的方法告诉脚本不要超时?

#!/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"
Run Code Online (Sandbox Code Playgroud)

Ini*_*ian 6

将timeout值设置为-1

set timeout -1
Run Code Online (Sandbox Code Playgroud)

摘录自expect,man page

如果未使用 timeout 关键字,则在超时时执行隐式空操作。默认超时时间为 10 秒,但可以通过命令“set timeout 30”设置,例如设置为 30。无限超时可以由值 -1 指定。