Skip to content

Commit

Permalink
fix: Ignore zero sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored May 4, 2024
1 parent 722e5d9 commit a8c8b84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/progress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ do
if [ -s "$file" ]; then
bytes=$(du -sb "$file" | cut -f1)
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/')
else
size=$(printf '%.1f\n' "$((bytes*100*100/total))e-2")
Expand Down

0 comments on commit a8c8b84

Please sign in to comment.