=====================================================
随机抽取学生终极版本!!
#!/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
===================================================================================
原文地址:http://blog.51cto.com/13490688/2306732
时间: 2024-11-10 14:14:15