Update progress.sh

This commit is contained in:
Kroese 2024-05-04 16:13:25 +02:00 committed by GitHub
parent 8b01a58165
commit 86ea11db0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,7 @@ do
if [ -s "$file" ]; then if [ -s "$file" ]; then
bytes=$(du -sb "$file" | cut -f1) bytes=$(du -sb "$file" | cut -f1)
if (( bytes > 1000 )); then if (( bytes > 1000 )); then
if [ -z "$total" ]; then if [ -z "$total" ] || [[ "$total" == "0" ]]; then
size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/') size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/')
else else
size=$(printf '%.1f\n' "$((bytes*100*100/total))e-2") size=$(printf '%.1f\n' "$((bytes*100*100/total))e-2")