期望 - expect_user的不同超时和期望?

gol*_*enk 2 expect

我希望有一个无限(或非常大)的超时expect_user和默认超时expect.有没有办法设置不同的超时?或者我只需要在每次使用更改之前手动执行此操作?

pyn*_*exj 5

无论expectexpect_user支持-timeout选项.通常我会在timeoutvar中设置默认超时值并使用-timeout选项for expect_user.例如:

set timeout 30; # the default timeout value

# don't time out when waiting for user's input
expect_user -timeout 100000 -re "(.*)\n"; # use -1 for infinite timeout
set user_input "$expect_out(1,string)"
Run Code Online (Sandbox Code Playgroud)