The following code gives
[: -ge: unary operator expected
when
i=0 if [ $i -ge 2 ] then #some code fi
Your piece of script works just great. Are you sure you are not assigning anything else before the if to "i"?
A common mistake is also not to leave a space after and before the square brackets.