【问题标题】:Iperf with tcl expect command带有 tcl 期望命令的 Iperf
【发布时间】:2012-04-29 19:15:16
【问题描述】:

我想通过运行 tclscript(自动化)来运行 iperf 命令。要在另一台 PC (Linux) 中运行的 iperf 命令。我正在使用 tclexpect 来做同样的事情,要求是打开一个控制台并运行 iperf 命令。代码如下。

puts "\n Enter the port no : " 
gets stdin sprt

puts "\n Enter the display intervel (in sec) : "
gets stdin sint

global spawn_id
set timeout 40 

spawn telnet $ip
expect "login:"
send "$user\r"

set timeout 10

expect "Password:"
send "$password\r"

expect "$"
send "iperf -s -u -p $sprt -i $sint" 

请帮帮我。

【问题讨论】:

  • 那么实际的问题是什么?请描述事情是如何不工作的……
  • 无法在 Linux PC 上打开新的终端(控制台),也无法运行 iperf。此外,控件不会回到主脚本

标签: tcl expect


【解决方案1】:

你差不多完成了。

像这样改变你的最后两行。

expect ".*$"
send "pwd\r"

【讨论】:

    猜你喜欢
    • 2014-02-19
    • 1970-01-01
    • 2012-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-19
    • 1970-01-01
    • 2015-03-20
    相关资源
    最近更新 更多