Compare commits
2 Commits
5144da4680
...
f5bea7cdc2
| Author | SHA1 | Date | |
|---|---|---|---|
| f5bea7cdc2 | |||
| e06ca74d1d |
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user