期待发送似乎不起作用

时间:2014-12-09 09:46:20

标签: send expect hang

方案

ftp login

正确生成功能

  spawn ftp super.super@xxx.xxx.xxx.com
  using master pty /dev/ncptyp0X
  spawn: returns {2812}
  expect: does "" (spawn_id exp4) match regular expression "$"? yes
  expect: set expect_out(0,string) ""
  expect: set expect_out(spawn_id) "exp4"
  expect: set expect_out(buffer) ""

期待正常运作

  expect: does "Connected to xxx.xxx.xxx.com.\r\n220 XXXX FTP SERVER 
  2 (Version 1) ready.\r\n331 Password required for SUPER.SUPER
  .\r\nPassword: " (spawn_id exp4) match glob pattern "Password:"? yes
  expect: set expect_out(0,string) "Password:"
  expect: set expect_out(spawn_id) "exp4"
  expect: set expect_out(buffer) "Connected to xxx.xxx.xxx.com.\r\n220 
  FTP SERVER  (Version H02 XXXX 23DEC2011) ready.\r\n331 Password requir
  ed for SUPER.SUPER.\r\nPassword:"

发送预期节目后发送[Expect -d out send:发送“yyyyy \ n”到{exp4}] 在缓冲区中仅使用空格阻止发送后期望

expect: does " " (spawn_id exp4) match glob pattern "ftp>"? no << it hangs here

问题需要改进。

代码

set timeout -1
set match_max 60000
set exp_internal 1
spawn ftp super.super@$machineName 
expect "Password:"
send "$password\r" 
expect "ftp>" 

它在expect "ftp>"

之后挂起

期望版本:5.43.0 m / c:Windows_NT 6 02 8664

0 个答案:

没有答案