linux/unix 中的 spawn、expect 和 send 命令是什么

What does spawn ,expect and send command in linux/unix

以下三行包含三个命令(spawn、expect、send),但实际上是做什么的。请解释任何一个

spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no usr@$myhost.example.com'<br>
expect "password"<br>
send "$PWD\n" <br>
EOD

它是 expect 脚本的一部分:

spawn 打开一个新进程

expect 等待先前生成的进程输出 "expected" 字符串(在本例中为密码)

send 写入生成的进程 stdin

EOD 在 expect 中没有任何意义,也许它是另一个脚本的一部分?