shell-清理日志
Posted shuiyonglewodezzzzz
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell-清理日志相关的知识,希望对你有一定的参考价值。
#!/bin/bash cleanFile() { for i in $(ls $1); do if [[ $i == "kafka" ]]; then return elif [[ $i == "zk" ]]; then return fi if [[ -d ${i} ]]; then ch="${1}/${i}" cd ${ch} cleanFile ${ch} cd .. else #echo "${1}/${i}" if [[ ${i} =~ ".out" ]]; then echo "remove ${i}" rm -rf "${1}/${i}" elif [[ ${i} =~ ".log" ]]; then echo "remove ${i}" rm -rf "${1}/${i}" elif [[ ${i} =~ ".txt" ]]; then echo "remove ${i}" rm -rf "${1}/${i}" fi fi done }
以上是关于shell-清理日志的主要内容,如果未能解决你的问题,请参考以下文章