From 7a126b3e23b0dd3039b0e48680b959947420f515 Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Mon, 11 Dec 2023 10:20:09 +0800 Subject: [PATCH] update --- bash/delete_than.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bash/delete_than.sh b/bash/delete_than.sh index c93a0e7..15f2ce2 100644 --- a/bash/delete_than.sh +++ b/bash/delete_than.sh @@ -6,14 +6,12 @@ folder="/home/pi/mp4" cd $folder # 获取文件夹的大小 size=$(du -sh "$folder" | awk '{print int($1)}') -while [[ $size -gt 50 ]] -do +while [ $size -gt 50 ]; do # 获取最早创建的文件 oldest_file=$(ls $folder -tr | head -1 | xargs) rm -f $oldest_file size=$(du -sh "$folder" | awk '{print int($1)}') - if [[ $size -le 50 ]] - then + if [ $size -le 50 ]; then exit 0 fi done \ No newline at end of file