Hello,
I was just looking at this thread, and it looks like one of the original problems was not addressed, though it is a small one.
When you ran that original script, there was no error message, a new prompt just showed up. That is because there is a line continuation character '\' at the end of the script. From the shell perspective, it is like typing a command but not hitting the return key. You can delete the final '\', or even just add a newline at the end.
It seems like you are past that problem, but maybe it is worth mentioning.
- rick