Float conditional in bash

Posted by Werner on Stack Overflow See other posts from Stack Overflow or by Werner
Published on 2010-04-21T13:01:36Z Indexed on 2010/04/21 13:13 UTC
Read the original article Hit count: 209

Filed under:

Hi,

in bash I need to compare two float numbers, one which I define in the script and the other read as paramter, for that I do:

   if [[ $aff -gt 0 ]]
    then
            a=b
            echo "xxx "$aff
            #echo $CX $CY $CZ $aff
    fi

but I get the error:

[[: -309.585300: syntax error: invalid arithmetic operator (error token is ".585300")

What is wrong?

Thanks

© Stack Overflow or respective owner

Related posts about bash