#!/usr/bin/expect
set timeout 10
set host [lindex $argv 0]
set username root
set password admin
set src_file [lindex $argv 1]
set dest_file [lindex $argv 2]
spawn scp [email protected]$host:$src_file $dest_file
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect "100%"
expect eof
时间: 2024-10-16 15:25:16