#!/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
本文出自 “朝闻道,夕死可矣” 博客,请务必保留此出处http://jinjianjun.blog.51cto.com/8539251/1592371
原文地址:http://jinjianjun.blog.51cto.com/8539251/1592371