converta seus valores disponíveis e de entrada em Kb e compare-os.
#!/bin/bash
echo -n "Enter the value ( value should end with G/M/K): "
read DISK_VALUE
AVAILABLE_SPACE=$(df -h . | awk 'NR==2{print $4}')
AVAILABLE_SPACE_IN_KB=$(echo "${AVAILABLE_SPACE}" | awk '/M$/{print ($0+0)*1024}/G$/{print ($0+0)*1024*1024}/K$/{print $0+0}')
COMPARE_VALUE_IN_KB=$(echo "${DISK_VALUE}" | awk '/M$/{print ($0+0)*1024}/G$/{print ($0+0)*1024*1024}/K$/{print $0+0}')
echo "AVAILABLE_SPACE_IN_KB : ${AVAILABLE_SPACE_IN_KB}"
echo "COMPARE_VALUE_IN_KB : ${COMPARE_VALUE_IN_KB}"
if [ "${AVAILABLE_SPACE_IN_KB}" -lt "${COMPARE_VALUE_IN_KB}" ]
then
echo "Available space (${AVAILABLE_SPACE}) is lesser than Given Value (${DISK_VALUE})"
else
echo "Available space (${AVAILABLE_SPACE}) is greater than Given Value (${DISK_VALUE})"
fi
$ bash a.sh
Enter the value : 1000K
AVAILABLE_SPACE_IN_KB : 100
COMPARE_VALUE_IN_KB : 1000
Available space (100K) is lesser than Given Value (1000K)
$ bash a.sh
Enter the value : 101M
AVAILABLE_SPACE_IN_KB : 102400
COMPARE_VALUE_IN_KB : 103424
Available space (100M) is lesser than Given Value (101M)