+
#!/usr/bin/expect -f
set ipaddress [lindex $argv 0]
set passwd [lindex $argv 1]
set timeout 5
spawn ssh
#######Input "yes" when prompt "yes/no"############
expect {
"yes/no" { send "yes\r"; exp_continue}
"password:" { send "$passwd\r" }
}
###################################################
expect "password:"
send "$passwd\r"
expect "]*"
send "mkdir -p /tmp/haha/haha2\r"
send "exit\r"
#./script IP PASSWD 就可以登录了
阅读(410) | 评论(0) | 转发(1) |