#!/usr/bin/expect

set IP     127.0.0.1
set USER    root
set PASSWORD    123456

spawn ssh $USER@$IP
expect {  
 "*yes/no" { send "yes\r"; exp_continue}  
 "*assword:" { send "$PASSWORD\r" }  
}  
interact

 

 posted on 2020-12-29 11:29  xdsfoo  阅读(96)  评论(0编辑  收藏  举报