期望脚本中的交互,期望和退出之间的区别

时间:2016-05-03 21:14:44

标签: linux expect

我有一个预期脚本如下。

#!/usr/bin/expect

set timeout 20

spawn "some_script.sh"

expect "Enter Auth Username:"
send "username\n"

expect "Enter Auth Password:"
send "password\n"

expect/interact/exit

我想知道使用expect / interact / exit之间有什么不同。

谢谢!

1 个答案:

答案 0 :(得分:3)

exit执行您的想法:立即退出脚本

interact将控制返回给人:如果在脚本给auth用户和passwd后手动输入内容,则必须输入人。

expect监视生成的模式进程,当模式匹配时,脚本继续执行下一条指令。

相关问题