我想通过运行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" 请帮帮我。
发布于 2012-08-08 22:35:00
您就快完成了。
像这样修改你的最后两行。
expect ".*$"
send "pwd\r"https://stackoverflow.com/questions/10208335
复制相似问题