user=root
ip=1.1.1.1
passwd=1111
expect<<!
spawn ssh $user@$ip
expect {
"(yes/no)?" {
send "yes\n"
expect "assword:"
send "$passwd\n"
}
"assword:" {
send "$passwd\n"
}
}
expect "#"
send "sh /root/sbin/get_master.sh\r"
send "exit\r"
expect eof
!
linux 使用expect
最新推荐文章于 2023-06-21 17:11:08 发布