#!/bin/bash #随机取出res目录下20个大于50K的图片并输出其名称 res=(`find res/ -name "*.png" -size +50k -o -name "*.jpg" -size +50k`) tmp_file="/tmp/temp_res.txt" touch $tmp_file > $tmp_file while [[ `uniq $tmp_file | wc -l` != 20 ]] do echo `expr $RANDOM % ${#res[@]}` >> $tmp_file done for i in `cat $tmp_file | sort -n` do echo ${res[$i]} done
时间: 2024-11-23 04:08:05