Problem with Greater Than Or Equal To

BASH problem with IS GREATER THAN OR EQUAL TO.

I have tried a dozen variations for this IF statement to work with IS GREATER THAN OR EQUAL TO. My code below WORKS.

array=( $( /usr/bin/sar -q 1 30 |grep Average |awk '{print $2,$3}' ) )
nthreads="${array[0]}"
avproc="${array[1]}"
if [ $nthreads = 1.0 ] && [ $avproc > 5 ]; then 
... i will work fine!!

I can not change : if [ $nthreads = 1.0 ] && [ $avproc > 5 ];
to work like if [ $nthreads >= 1 ] && [ $avproc >= 5 ];

I believe part of the problem is the decimal number. But I have tried -gt. I have tried using (( )) expressions. I have attempted to use bc. Many times I get the error 'unary operator expected'.

I have been looking for a few days now and have tried everything I can think of. It seems I have a fundamental problem with how BASH handles variable and data types.

Help appreicated. Thanks

assuming integer arithmetic....

 if [ $nthreads -ge 1 -a $avproc -ge 5 ]; then 

Thanks for reply.

I think that would have worked if my variable was not a decimal. I think thats part of the problem.

Error:
line 5: [: 0.0: integer expression expected

function myGE
{
  echo "if (${1} >= ${2}) 1" | bc
}



 if [ "$(myGE "${nthreads}" 1)" -eq 1 -a "$(myGE "$avproc" 5)" -eq 1 ]; then

Bash cannot directly handle decimal numbers like 4.5 because it does not have built-in support for floating point.

That said.

Can you convert 1.0 in to 1 without using a function? Strip off the decimal?

$x = 2.0
.... =2

Thanks

Try:

echo ${x%%.*}
if [ ${nthreads%%.*} -eq 1 ] && [ $avproc -gt 5 ]; then