@bigrigdriver - actually, either is applicable in bash. Although I do personally prefer == from a visual perspective.
You appear to be confusing parameters with the value stored in your variable. Shift has no affect on "i" but rather on the parameters.
So when $i is equal to 2, it never stops being equal to 2. Also, as you are comparing numbers you should either use -eq for the test or the more
preferred (()) when testing numbers.
So I would suggest something like:
while (( $# ))
if (( $1 == 2 ))