
日志文件清空方法#!/bin/bash cd /opt/autosp ls -trl *log* | awk {print $9} | sh参数过长清理方法创建日志文件touch {1..100000}.log1 touch {1..100000}.log2 touch {1..100000}.log3 touch {1..100000}.log4 touch {1..100000}.log5直接删除会报错“参数列表过长”无法直接使用rm删除[rootlocalhost ~]# rm -rf *log* bash: /usr/bin/rm: 参数列表过长编写清理脚本vim clear.shfind . -name *log* | xargs -n 4 rm # 或 find . -name *log* -print0 | xargs -0 -n 4 rm执行清理脚本即可sh clear.sh