fix: Display size in iec format (#400)

This commit is contained in:
Kroese 2024-01-29 05:09:44 +01:00 committed by GitHub
parent fca0a71976
commit be4745b2df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,7 @@ do
if [ -f "$file" ]; then if [ -f "$file" ]; then
bytes=$(du -sb "$file" | cut -f1) bytes=$(du -sb "$file" | cut -f1)
if (( bytes > 1000 )); then if (( bytes > 1000 )); then
size=$(echo "$bytes" | numfmt --to=si --suffix=B | sed -r 's/([A-Z])/ \1/') size=$(echo "$bytes" | numfmt --to=iec --suffix=B | sed -r 's/([A-Z])/ \1/')
echo "${body//(\[P\])/($size)}"> "$info" echo "${body//(\[P\])/($size)}"> "$info"
fi fi
fi fi