lock_percent=$(echo "scale = 5; $value2*100/$value1" | bc)
value=`echo "$lock_percent" | bc`
if [[ "$value" > "$8" ]]; then
echo "Lock Percentage:$value percentage State Critical"
exit $STATE_CRITICAL
fi
I am not able to perform a float comparison with this. Where am I going wrong?
Bash itself can’t use float. In this case maybe you can multiply by 10 or 100 (etc.) and get integer value which you can compare. Or, you can use bc comparison and return value: