-------------------------------------------------------fordo.sh 利用for循环脚本调scp的脚本实现批量传文件
#!/bin/bash
set -x
for y in 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
do
sh scp2.sh $y
#expect scp.sh $y
done
------------------------------------------------scp2.sh
#!/bin/bash
bat=$1
/usr/bin/expect -c "
spawn bash -c \"scp /data/all_zc_up/zongcai/zztf/${bat}0data/0*380000GJDX000005580020190820*.gz root@132.35.233.35:/hana/data/zc_file_190814/zztf\"
expect \"Password:\"
send \"root\r\"
set timeout 3
send \"exit\r\"
expect eof"