Thanks. I tried yours and was getting the same error, so I Did the sh -x script, with the error to a file. It was giving an error on line 31. So out of the blue I moved the first echo up on to the same line as the else statement and it works.
I'm going to do the same thing with the script I wrote also, to see if thats what was causing my problems.
Again, thanks for the help