Expect - expect_user 和 expect 的不同超时?
Expect - Different timeout for expect_user and expect?
我想要 expect_user
的无限(或非常长的)超时和 expect
的默认超时。有没有办法设置不同的超时?还是我只需要在每次更改用法之前手动执行此操作?
expect
和expect_user
都支持-timeout
选项。通常我会在 timeout
var 中设置默认超时值,并为 expect_user
使用 -timeout
选项。例如:
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)"
我想要 expect_user
的无限(或非常长的)超时和 expect
的默认超时。有没有办法设置不同的超时?还是我只需要在每次更改用法之前手动执行此操作?
expect
和expect_user
都支持-timeout
选项。通常我会在 timeout
var 中设置默认超时值,并为 expect_user
使用 -timeout
选项。例如:
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)"