I think your variable declaration needs some work.
Here's a snippet from a script I wrote to backup my blog database. First, I created a directory to hold the backup, then I ran mysqldump and dumped the backup into that variable.
I am not a coder and I'm sure there was a better way, but this worked. In this case, I wanted the hour and minute in the directory name.
#Set the variable DATE
#Define now as today’s day-month-year-hour-minute.
#Make the directory to hold the backup file.
See this: http://tldp.org/LDP/Bash-Beginners-G...ners-Guide.pdf
. It's excellent.