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

风格不统一 提交于 2019-12-11 05:46:43

问题


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"

回答1:


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.



来源:https://stackoverflow.com/questions/41702790/can-expect-be-told-not-to-timeout-without-explicitly-setting-a-huge-constant-val

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!