#!/usr/bin/expect
set timeout 10
set host app2
set username root
set password 12345@
set src_file [lindex $argv 0]
set dest_file [lindex $argv 1]
spawn scp $src_file $username@$host:$dest_file
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect "100%"
expect eof
linux expect 远程copy
最新推荐文章于 2022-08-15 12:12:43 发布