先算数量,判断后再删 filenum=`find . -name "log.*" -mtime +10 | wc -l`if [ $filenum -gt 10 ] ; thenfilenum=`find . -name "log.*" -mtime +10 -exec rm -f {} \;fi