Iperf与tcl期望命令

时间:2012-04-18 11:24:22

标签: tcl expect

我想通过运行tclscript(自动化)来运行iperf命令。 iperf命令在另一台PC(Linux)中运行。我使用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" 

请帮帮我。

1 个答案:

答案 0 :(得分:0)

你差不多完成了。

更改你的最后两行。

expect ".*$"
send "pwd\r"
相关问题