Update reset.sh

This commit is contained in:
Kroese 2025-03-18 12:09:58 +01:00 committed by GitHub
parent 8316583e2e
commit f5318c4165
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,13 +105,9 @@ fi
formatBytes() { formatBytes() {
local result local result
result=$(numfmt --to=iec "$1") result=$(numfmt --to=iec --suffix=B "$1")
result=$(echo "$result" | sed -r 's/([A-Z])/ \1/' | sed 's/ B/ bytes/g;')
local unit="${result//[0-9. ]}" local unit="${result//[0-9. ]}"
if [ -z "$unit" ]; then
unit="bytes"
else
unit=$(echo "${unit^^}" | sed 's/K/KB/g;s/M/MB/g;s/G/GB/g;s/T/TB/g')
fi
result="${result//[a-zA-Z ]/}" result="${result//[a-zA-Z ]/}"
if [[ "${2:-}" == "up" ]]; then if [[ "${2:-}" == "up" ]]; then
if [[ "$result" == *"."* ]]; then if [[ "$result" == *"."* ]]; then