I'm not sure why does this crazy "x" prefix tale still continue. You can simply quote them instead. Especially if you use bash and not some other sh-compatible shell:
if [ "$1" == "$2" ];
will work just fine.If you need all sh compatibility, it should be test for "x$1" anyway (still quoted).