1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-07 20:54:21 +00:00

Supports multi-disk detection

This commit is contained in:
Tw93
2025-11-23 20:20:46 +08:00
parent 54c30d6b60
commit a3de827fde
2 changed files with 62 additions and 18 deletions

View File

@@ -132,8 +132,10 @@ check_cache_size() {
for cache_path in "${cache_paths[@]}"; do
if [[ -d "$cache_path" ]]; then
local size=$(du -sk "$cache_path" 2>/dev/null | awk '{print $1}' || echo "0")
cache_size_kb=$((cache_size_kb + size))
local size_output
size_output=$(du -sk "$cache_path" 2>/dev/null | awk 'NR==1 {print $1}' | tr -d '[:space:]' || echo "")
[[ "$size_output" =~ ^[0-9]+$ ]] || size_output=0
cache_size_kb=$((cache_size_kb + size_output))
fi
done