发送带有期望的命令-结果不显示

时间:2019-01-14 07:25:23

标签: python linux bash shell expect

我开发了这个期望脚本。

我的脚本。我使用Expect lang。该脚本连接到主机并发送命令。命令结果不查看。状态已排序,并且期望脚本发送下一个命令(退出;)。请帮忙。

spawn connect host1
<mgsvp:lai=all;
ORDERED
<exit;
Disconnected from host1

我的调试日志

expect:does "" (spawn_id exp7) match glob pattern "RECONN EXECUTED"? no
mgsvp:lai=all;
expect:does "mgsvp:lai=all;\r\n" (spawn_id exp7) match glob pattern "RECONN EXECUTED"? no
ORDERED
expect:does "mgsvp:lai=all;\r\nORDERED\r\n" (spawn_id exp7) match glob pattern "RECONN EXECUTED"? no
<
expect:does "mgsvp:lai=all;\r\nORDERED\r\n<" (spawn_id exp7) match glob pattern "RECONN EXECUTED"? no
expect:timed out
send:sending "exit;\r" to { exp7 }
exit;
Disconnected from host1

实际数据结果。

connect host1

<mgsvp:lai=all;
ORDERED
<
COMMAND SESSION SUSPENDED
MT MOBILE SUBSCRIBER SURVEY RESULT

LAI            NSUB       NSUBA      NSUBE      NSUBG
400-01-300         90839      86623          0          0
400-01-4050       132468     126163      11090          0
400-01-4055        51051      48394       4409          0
400-01-355        106921     101760          0          0
400-01-500        103834      99747       2033          0
400-01-520        139383     133240       3513          0
400-01-330        130520     124545          0          0
400-01-550         56568      53829          0          0
400-01-4052        90542      85989        845          0
END
 RECONN EXECUTED
<exit; 
Disconnected from connect host1

0 个答案:

没有答案