/usr/local/bin/expect -f
set password *******
spawn scp -rp /home/ x.x.x.x:/home/ ###不要写成/home/*
expcet "user@x.x.x.x's password:"
send "$password\r"
send "exit\r"
expect eof
/usr/local/bin/expect -f
set password *******
spawn scp -rp /home/ x.x.x.x:/home/ ###不要写成/home/*
expcet "user@x.x.x.x's password:"
send "$password\r"
send "exit\r"
expect eof
转载于:https://www.cnblogs.com/flyback/articles/6179372.html