可以期望被告知不要在没有显式设置一个巨大的恒定值的情况下超时吗? [英] can expect be told not to timeout without explicitly setting a huge constant value?

查看:79
本文介绍了可以期望被告知不要在没有显式设置一个巨大的恒定值的情况下超时吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将超时设置为愚蠢的高数字.有没有更好的办法告诉脚本不要超时?

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"

推荐答案

timeout值设置为-1

set timeout -1

expect的摘录, man page

An excerpt from the expect, man page

如果不使用超时关键字,则在超时时执行隐式null操作. 默认超时时间为10秒,但可以通过命令"set timeout 30"将其设置为例如30. 可以用值-1指定无限超时..

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.

这篇关于可以期望被告知不要在没有显式设置一个巨大的恒定值的情况下超时吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆