亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

用expect實現(xiàn)的自動登錄到多臺服務(wù)器的shell腳本

 更新時間:2013年02月25日 15:05:35   作者:  
自動登錄到多臺服務(wù)器的shell腳本,用expect來實現(xiàn)的一段代碼,需要的朋友可以參考下
復(fù)制代碼 代碼如下:

#!/usr/bin/expect -f
set ipaddress [lindex $argv 0]
set passwd [lindex $argv 1]
set timeout 30
spawn ssh root@$ipaddress
#expect "yes/no"
#send "yesr"
expect "password:"
send "$passwdr"
expect "]*"
send "mkdir -p /tmp/haha/haha2r"
send "exitr"

***************
expect {
"(yes/no)?" {
     send "yesn"
  }
"password:" {
   ....
}
判斷語句
if {$havepass == 0} {
  expect "password:" { send "$pwn" }
}

或者:

expect {
"yes/no" { send "yesr"; exp_continue}
"password:" { send "$passwdr" }
}

相關(guān)文章

最新評論