From fca0a71976411ad6e2d12a018712acee29b7b19e Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 29 Jan 2024 04:51:59 +0100 Subject: [PATCH] feat: Show download progress (#399) --- src/progress.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/progress.sh b/src/progress.sh index 1b88d9a..2afa4fa 100644 --- a/src/progress.sh +++ b/src/progress.sh @@ -22,8 +22,11 @@ fi while true do if [ -f "$file" ]; then - size=$(stat -c '%s' "$file" | numfmt --to=si --suffix=B) - echo "${body//(\[P\])/($size)}"> "$info" + bytes=$(du -sb "$file" | cut -f1) + if (( bytes > 1000 )); then + size=$(echo "$bytes" | numfmt --to=si --suffix=B | sed -r 's/([A-Z])/ \1/') + echo "${body//(\[P\])/($size)}"> "$info" + fi fi sleep 1 done