1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| #! /usr/bin/bash
src=$1 dst=$2
hosts=( "host1" "host2" "host3" )
if [ "x$src" = "x" -o "x$dst" = "x" ] then echo "Failed: src or dst can't be empty" exit -1 fi
for host in "${hosts[@]}" do echo "begin to scp $src to $host:$dst" scp -r $src $host:$dst done
|