The real solution is that as soon as you need square brackets, switch to a better language than bash
Why would you need square brackets if test is the same?