Were you able to figure this out? Personally I've found that using keys for authentication is much more reliable (and possibly more secure?) than using passwords in scripting tasks like this. Is that an option in your case?
Thanks for your reply but yea, you were absolutely right. I resolved it by using RSA. I actually had done it before, it is just I haven't used linux for a while and I had to kinda learn things again. = )
Thanks and I am all set.