shell script.ssh自动应答脚本
#!/usr/bin/expect
set user [lindex $argv 0] #参数1:用户名
set ip [lindex $argv 1] #参数2:ip
set password [lindex $argv 2] #参数3:密码
spawn ssh ${user}@$ip
expect {
"(yes/no)?"
{
send "yes\r";exp_continue}
"password:"
{
send "$password\n"}
}
interact