Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Timeout 在我的expect脚本中,它在哪里超时?_Timeout_Expect - Fatal编程技术网

Timeout 在我的expect脚本中,它在哪里超时?

Timeout 在我的expect脚本中,它在哪里超时?,timeout,expect,Timeout,Expect,在我的expect脚本expect_after中,捕获来自BadPromptPassword的超时,但是如何返回这是我的expect脚本超时的地方?我已经和expect_玩过了,它没有给我我需要的东西。。。谢谢你的帮助。谢谢 spawn telnet 172.27.228.239 expect { timeout { puts "Timed out waiting for response from telnet ('172.27.228.230',)."; exit 1} "P

在我的expect脚本expect_after中,捕获来自BadPromptPassword的超时,但是如何返回这是我的expect脚本超时的地方?我已经和expect_玩过了,它没有给我我需要的东西。。。谢谢你的帮助。谢谢

spawn telnet 172.27.228.239
expect {
    timeout { puts "Timed out waiting for response from telnet ('172.27.228.230',)."; exit 1}
    "Password:" { send "lab\r"; }
    "\[>#\]"
};

send "en\r"
expect_after {
    timeout {
      puts "a default timeout clause for all subsequent expect commands ";
      exit 1
    }
}
expect "#>"
send "admin"
expect "BadPromptPassword:"
send "lab\r"
close
wait
这里有一个快速破解

expect_after {
    timeout {
        puts "timed-out expecting $pattern";
        exit 1
    }
}

set pattern "#>"
expect $pattern
send "admin"

set pattern "BadPromptPassword:"
expect $pattern
send "lab\r"