I\'m writing a single line command that backups all databases into their respective names instead using of dumping all in one sql.
Eg: db1 get saved to db1.sql and
Not an answer to your question, but take a look at the AutoMySQLBackup project on Sourceforge, instead of re-inventing the wheel. It does what you want, and offers a ton of additional features on top, including compression, encryption, rotation, and email notifications. I used it a while back and it worked really well.