Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Comparing float or integers in if using bash

if (( $(bc <<< "$1 > 0.0 && $1 > $2") )) ; then
        echo
        echo "$1 is greater than $2"
        echo
else
        echo
        echo "$2 is greater than $1"
        echo
fi
 
PREVIOUS NEXT
Tagged: #Comparing #float #integers #bash
ADD COMMENT
Topic
Name
8+6 =