标签:ack list int grep -v let backup pre sort 保留
#!/bin/bash Filelist=$(ls -l /data/backup/|egrep "^d"|awk ‘{print $9}‘) for i in $Filelist; do count=$(ls -l /data/backup/$i|grep -v total|wc -l) while(($count > 10)); do OldFile=$(ls -rt /data/backup/$i|sort -n|head -1) echo "Delete File:"/data/backup/$i/$OldFile; rm -f /data/backup/$i/$OldFile count=$(ls -l /data/backup/$i|grep -v total|wc -l) done done
标签:ack list int grep -v let backup pre sort 保留
原文地址:https://www.cnblogs.com/sonfer/p/12810657.html