Hello friend,
If you put the shebang '#!/bin/sh -x', you will see a detailed description line by line, with this I could notice that SH is giving error in if brackets, just remove one of the brackets that everything will work.
Test:
$ ./teste dns
+ PACKAGE=dns
+ grep dns
+ ls ./
+...