Hi guys,
I try to compare my variable which called $number.
And $number could be integer or decimal.
when I tried using comparison like this :
it works only for if $number is integer, if $number is not decimal (such as 4.5). It didnt work.
But when I tried using comparison like this :
It worked for decimal but,
The problem is if $number is 13, $number is gonna less than 5. Because it just compare the first digit.
So, what comparison should I use to compare the number which is decimal or integer.
Thanks guys.
I try to compare my variable which called $number.
And $number could be integer or decimal.
when I tried using comparison like this :
Code:
if [[ $number -lt 5 ]]
it works only for if $number is integer, if $number is not decimal (such as 4.5). It didnt work.
But when I tried using comparison like this :
Code:
if [[ $number<5 ]]
It worked for decimal but,
The problem is if $number is 13, $number is gonna less than 5. Because it just compare the first digit.
So, what comparison should I use to compare the number which is decimal or integer.
Thanks guys.