From 59693006f474a7bf108553791fb18a67b58609f7 Mon Sep 17 00:00:00 2001 From: BrainwreckedTech <3752022+BrainwreckedTech@users.noreply.github.com> Date: Tue, 28 Dec 2021 08:18:52 -0500 Subject: [PATCH] Don't bump up factor unless > 10 (Show 1000G instead of 1TB, etc.) --- bdmap | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bdmap b/bdmap index ab760b4..4ca5d84 100755 --- a/bdmap +++ b/bdmap @@ -26,15 +26,15 @@ BLK_INFO="$(echo "${BLK_INFO}" | awk '{t=$1; $1=$2; $2=t; print;}')" echo "${BLK_INFO}" | while read -r LOCATION BLOCKDEV; do DEVICE_ID="$(ls -l --color=never /dev/disk/by-id | sed 's/ \+/ /g' | grep -v 'nvme-eui\|wwn-' | grep "${BLOCKDEV}$" | cut -d\ -f9)" DEV_BYTES="$(lsblk -bnPo NAME,SIZE | grep "\"${BLOCKDEV}\"" | cut -d\" -f 4)" - if [ "${DEV_BYTES}" -ge $((1000**5)) ]; then + if [ "${DEV_BYTES}" -ge $((10**16)) ]; then DEVICE_SZ="$((DEV_BYTES/1000**5))P" - elif [ "${DEV_BYTES}" -ge $((1000**4)) ]; then + elif [ "${DEV_BYTES}" -ge $((10**13)) ]; then DEVICE_SZ="$((DEV_BYTES/1000**4))T" - elif [ "${DEV_BYTES}" -ge $((1000**3)) ]; then + elif [ "${DEV_BYTES}" -ge $((10**10)) ]; then DEVICE_SZ="$((DEV_BYTES/1000**3))G" - elif [ "${DEV_BYTES}" -ge $((1000**2)) ]; then + elif [ "${DEV_BYTES}" -ge $((10**7)) ]; then DEVICE_SZ="$((DEV_BYTES/1000**2))M" - elif [ "${DEV_BYTES}" -ge 1000 ]; then + elif [ "${DEV_BYTES}" -ge 10000 ]; then DEVICE_SZ="$((DEV_BYTES/1000))K" else DEVICE_SZ="${DEV_BYTES}B"