diff --git a/scripts/db-backup.sh b/scripts/db-backup.sh index e4185ec..27abbf1 100755 --- a/scripts/db-backup.sh +++ b/scripts/db-backup.sh @@ -52,9 +52,9 @@ ensure_postgres_running() { format_size() { local bytes=$1 - if (( bytes >= 1073741824 )); then printf "%.1f GB" "$(echo "$bytes / 1073741824" | bc -l)" - elif (( bytes >= 1048576 )); then printf "%.1f MB" "$(echo "$bytes / 1048576" | bc -l)" - elif (( bytes >= 1024 )); then printf "%.1f KB" "$(echo "$bytes / 1024" | bc -l)" + if (( bytes >= 1073741824 )); then printf "%d.%d GB" $((bytes / 1073741824)) $(( (bytes % 1073741824) * 10 / 1073741824 )) + elif (( bytes >= 1048576 )); then printf "%d.%d MB" $((bytes / 1048576)) $(( (bytes % 1048576) * 10 / 1048576 )) + elif (( bytes >= 1024 )); then printf "%d.%d KB" $((bytes / 1024)) $(( (bytes % 1024) * 10 / 1024 )) else printf "%d B" "$bytes" fi }