vim /usr/local/sbin/expect/run.sh
#!/bin/bash
publicfilelist="/tmp/publicfilelist.txt"
for desip in `cat /tmp/desip.txt`; do./one-more-rsync.sh $desip $publicfilelist //注意參數(shù)的順序
done
執(zhí)行run.sh
[root@localhost expect]# bash run.sh
spawn rsync -avR --files-from=/tmp/publicfilelist.txt / root@192.168.221.20:/
root@192.168.221.20's password:
building file list ... done
aa/
aa/aa.txt
bb/
bb/bb.txt
cc/
cc/cc.txt
dd/
dd/dd.txtsent 328 bytes received 100 bytes 856.00 bytes/sec
total size is 12 speedup is 0.03
spawn rsync -avR --files-from=/tmp/publicfilelist.txt / root@192.168.221.30:/
The authenticity of host '192.168.221.30 (192.168.221.30)' can't be established.
ECDSA key fingerprint is SHA256:UiIDDUfExrEZLxrI8+z6PWjWsNCO2GTDDfTKpEhQaWY.
ECDSA key fingerprint is MD5:4e:79:bd:c6:bb:8d:b7:ee:1a:a4:cb:25:03:22:10:5f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.221.30' (ECDSA) to the list of known hosts.
root@192.168.221.30's password:
building file list ... done
aa/
aa/aa.txt
bb/
bb/bb.txt
cc/
cc/cc.txt
dd/
dd/dd.txtsent 328 bytes received 100 bytes 285.33 bytes/sec
total size is 12 speedup is 0.03