Right, so now we see that the switches are being fed information stored in variables, hence really quite different than what is in the command line example.
Try putting set -xv as the second line of the script and you may be surprised as to what you see is stored in the variables
On a side note, I will assume the current second line is a typo as of course any spaces around equals sign will cause no end of issues.
The second thing I would point out is you do not need cat in any of the invocations where you are using it as grep, or maybe better with awk or sed to also ignore the cut, can easily
be used to read a file. I may even suggest that using a bash loop to read the config may have been just as simple
Let us know how you get on?