Don't use exponent math in POSIX sh

master
BrainwreckedTech 3 years ago
parent c8e87e5b08
commit f161759b3d

@ -22,13 +22,13 @@ case "${1}" in
echo "${BLK_INFO}" | while read -r BLOCKDEV DEV_PORT DEV_HCIL; do echo "${BLK_INFO}" | while read -r BLOCKDEV DEV_PORT DEV_HCIL; do
DEVICE_ID="$(ls -l --color=never /dev/disk/by-id | sed 's/ \+/ /g' | grep -v 'nvme-eui\|wwn-' | grep "${BLOCKDEV}$" | cut -d\ -f9)" 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)" DEV_BYTES="$(lsblk -bnPo NAME,SIZE | grep "\"${BLOCKDEV}\"" | cut -d\" -f 4)"
if [ "${DEV_BYTES}" -ge $((1000**5)) ]; then if [ "${DEV_BYTES}" -ge $((1000000000000000)) ]; then
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^5}" | cut -b1-5)T" DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^5}" | cut -b1-5)T"
elif [ "${DEV_BYTES}" -ge $((1000**4)) ]; then elif [ "${DEV_BYTES}" -ge $((1000000000000)) ]; then
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^4}" | cut -b1-5)T" DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^4}" | cut -b1-5)T"
elif [ "${DEV_BYTES}" -ge $((1000**3)) ]; then elif [ "${DEV_BYTES}" -ge $((1000000000)) ]; then
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^3}" | cut -b1-5)G" DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^3}" | cut -b1-5)G"
elif [ "${DEV_BYTES}" -ge $((1000**2)) ]; then elif [ "${DEV_BYTES}" -ge $((1000000)) ]; then
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^2}" | cut -b1-5)M" DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000^2}" | cut -b1-5)M"
elif [ "${DEV_BYTES}" -ge 1000 ]; then elif [ "${DEV_BYTES}" -ge 1000 ]; then
DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000}" | cut -b1-5)K" DEVICE_SZ="$(awk "BEGIN {print ${DEV_BYTES}/1000}" | cut -b1-5)K"

Loading…
Cancel
Save