At the first loop, $ expansion will compute the expression and will find that vCompteur is equal 1. But in the loop the value of the variable vCompteur will change to 2 and then when $ expansion will compute the expression normally it should find that vCompteur is equal 2.
Something doesn't make sense, or maybe I'm missing something.
Actually your second script is actually the correct way to code this loop. Used this way vCompteur behaves like a variable in a normal language, and so does the do while loop
To explain why the first one does not work - which is that the variable expansion happens before the script line is interpreted, this creates a compare between two number literals, not a variable and a number. The while condition is set up from this (once), hence an infinite loop.
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein