0

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" 

私を助けてください。

4

1 に答える 1

0

これでほぼ完了です。

最後の 2 行を次のように変更します。

expect ".*$"
send "pwd\r"
于 2012-08-08T14:35:00.383 に答える