#/bin/bash
expect << END
set timeout 15
#kill the existing progress that have already be running
spawn sudo killall ssh
expect "sudo" {send "yourpwd\r"}
spawn sudo ssh -L .... #something you specify
expect {
"sudo" {
send "yourpwd\r"
exp_continue
}
"yes" {
send "yes\r"
exp_continue
}
-nocase "password:" {
send "sshpwd\r"
exp_continue
}
}
wait
END
没有评论:
发表评论