shell 遍历文件夹并scp文件

#!/bin/bash
for file in /root/testdatas/*
do
    if test -f $file
    then
        arr=(${arr[*]} $file)
    fi
done
#echo ${arr[@]}

for i in ${arr[@]}
do
    #echo $i
    scp $i slave:/root/testdatas/
done

你可能感兴趣的:(shell)