0
命令我新的希望。我試圖在循環中運行一個命令。Expect腳本來運行循環
- SSH連接到一臺機器
- 執行相同的命令多次
package require Expect
set uname admin
set password default
set hostname "182.35.44.35"
#SSH into Appliance
set timeout 10
cd /cygwin/bin
puts "changed into directory and exec telnet"
spawn telnet "$hostname"
expect "br"
exp_send "admin\r"
expect "Password"
exp_send "******\r"
expect "br"
exp_send "zzdebugshell\r"
after 1000
send "*******\r"
after 1000
send "*******\r"
expect "debugshell#"
after 1000
set times 0;
while { $times < 10 }
{
send "vmstat -n 2 5\r"
set times [expr $times+1];
}
expect "debugshell"
exp_send "exit\r"
expect "br"
exp_send "exit\r"
exit
Error : debugshell# child process exited abnormally
能否請你幫我這個?