aa=("admin" "first" "second" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twleve" "thrteen")
bb=(${aa[0]})
unset aa[0]
aa=(${aa[@]})
k=0
while [ ${#aa[@]} -gt 0 ]
do
dd=()
cc=()
while [ ${#bb[@]} -gt 0 ]
do
if [ ${#aa[@]} -eq 0 ]
then
break
fi
b1=${bb[0]}
unset bb[0]
bb=(${bb[@]})
a1=${aa[0]}
unset aa[0]
aa=(${aa[@]})
echo "$b1---$a1"
sleep 5 && echo "$b1--$a1" >>last.txt &
cc=(${cc[@]} "$!" )
let k+=1
dd=(${dd[@]} "$b1" "$a1" )
done
wait
k=0
bb=(${dd[@]})
done
echo "ok"
转载于:https://blog.51cto.com/biott/1112347