Better and more bulletproof test.sh.