The below code will return a result of 10.9.2
OSCHECK="$(sw_vers -productVersion)"
So running something like the below code works fine
OSCHECK="$(sw_vers -productVersion)"
if test "$OSCHECK" == "10.9.2"
then
echo "This Machine is 10.9.2 or above"
else
echo "This Machine is 10.9.1 or below"
fi
However I would like it to be a bit more precise. I would like it to give me an equal or greater result. If I run the code below it doesn't give me the result I'm looking for, it passes the first command and returns an "else" result. What am I doing wrong?
OSCHECK="$(sw_vers -productVersion)"
if [ "$OSCHECK" >= "10.9.2" ];
then
echo "This Machine is 10.9.2 or above"
else
echo "This Machine is 10.9.1 or below"
fi