远程控制主机脚本

expect 脚本, 命名格式,expect.*       expect开头

#!/usr/bin/expect
# 
#
set USER root
set ADDR 10.0.0.77
set PASSWD lyjatech
spawn ssh $USER@$ADDR
expect {
   "yes/no" { send "yes\n";exp_continue }
   "password" { send "$PASSWD\n" }
}
interact

 

posted @ 2022-04-27 21:43  goodbay说拜拜  阅读(61)  评论(0编辑  收藏  举报