天天看點

1、Expect 遠端登入linux系統

spawn 啟動新的程序

expect 從程序接收字元串

send 向程序發送字元串

interact 允許使用者互動

遠端登入linux系統

#!/usr/bin/expect

set timeout 30

spawn ssh -l root 192.168.130.195

expect "(yes/no)?"

send "yes\r"

expect "password:"

send "123456\r"

interact

      本文轉自開源殿堂 51CTO部落格,原文連結:http://blog.51cto.com/kaiyuandiantang/1947015,如需轉載請自行聯系原作者

繼續閱讀