带有期望的Bash脚本

时间:2014-04-07 00:13:54

标签: bash expect

我有最简单的脚本:

#!/usr/bin/expect
expect "hello"
send -- "ll \r"

当我运行它时,我手动输入“hello”字,并且ll命令永远不会运行...

然后我放exp_internal 1然后出现

[root@localhost tmp]# ./file1.exp

expect: does "" (spawn_id exp0) match glob pattern "hello"? no
hello

expect: does "hello\n" (spawn_id exp0) match glob pattern "hello"? yes
expect: set expect_out(0,string) "hello"
expect: set expect_out(spawn_id) "exp0"
expect: set expect_out(buffer) "hello"
}end: sending "ll \r" to { exp0 ll
[root@localhost tmp]#

任何人都可以解释为什么命令没有作为命令运行吗?

0 个答案:

没有答案
相关问题