#!/bin/bash
expect -c "
set timeout 1200;
spawn /usr/bin/scp -r 192.168.142.128:/shell/backup.tar.gz /shell
expect {
\"*yes/no*\" {send \"yes\r\"; exp_continue}
\"*password*\" {send \"123456\r\";}
}
expect eof;"
expect -c "
set timeout 1200;
spawn /usr/bin/scp -r 192.168.142.128:/shell/backup.tar.gz /shell
expect {
\"*yes/no*\" {send \"yes\r\"; exp_continue}
\"*password*\" {send \"123456\r\";}
}
expect eof;"
转载于:https://blog.51cto.com/yangshi/1168637