=====================================================
随机抽取学生终极版本!!
#!/bin/bash
touch ./temp
read -p "输入抽取人数" C
while [ sort temp | uniq | wc -l
!= $C ]
do
echo expr $RANDOM % 15
>> temp
done
Z=$(sort temp | uniq)
echo $Z
jw=('居思涵' '李月' '李鑫' '唐伟宏' '王大高' '纪平' '陈磊' '赵鹏凯' '聂田蔚' '张政' '刘宏杰' '黄辉' '郑文' '靖儿' '啊莉' )
for v in ${Z[@]}
do
echo ${jw[$v]}
done
rm temp
===================================================================================
转载于:https://blog.51cto.com/13490688/2306732