jeudi 10 septembre 2015

Bash: If statement always evaluates to true even when its not [duplicate]

This question already has an answer here:

Im trying to write a simple If statement that i cant seem to get write. the code is as follows:

PERC=.5
if [  "$PERC" > "1.00" ]
        then
                echo "CHECK_ESX3 CRITICAL -\"$VM\" cpu ready="$PERC"% | cpu_ready="$PERC"%;;"
        else
                if [ "$PERC" < "1.00" ]
                        then
                                echo "CHECK_ESX3 WARNING -\"$VM\" cpu ready="$PERC"% | cpu_ready="$PERC"%;;"
                fi
fi

No matter what way i try to code it it always enters the first IF statement. can anyone offer me some help ?

thanks in advance.

Aucun commentaire:

Enregistrer un commentaire