blob: 8ab5bf88e01e2d0e4efe1daf271d9b628ed2317a [file]
#!/usr/bin/expect
# USAGE: ssh-no-interactive <host> <username> <password> <command>
set timeout 10
set host [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set command [lindex $argv 3]
spawn ssh $username@$host "$command"
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect eof