#!/usr/bin/expect
set timeout 1
set filename [lindex $argv 0]
set ip [lindex $argv 1]
spawn scp -l 1000 root:/bigdate/file/${filename} zsj@${ip}:/home/zsj/shell/txt/
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "123456\n"}
}
"*assword:"
{
send "123456\n"
}
}
expect "100%"
expect eof
使用expect实现跨主机免密传输
最新推荐文章于 2022-04-21 18:56:59 发布