How To, MySQL to CSV - Script

I wanted to share a new script that I was writing,
This script knows how to take SQL queries, convert them to csv files and send them by eMail.

the script is divided to 2 files:
the first one contain all the sql queries, and the second do all the amazing job.

The fist file called SQL.reports can be download from HERE, contain the sql queries, the syntax must be like the example:
ReportName your_report_name
sql your query

ReportName your_second_report_name
sql select * from tableA where [...]

The script file called can be download from HERE,
the only things you need to do for this to work is to fill the next parameters in the script:
DBname="your DB name"
DBuser="your DB user name"
DBpass="your DB password"
Mail_to='list of mail with space between them'
please do not touch the rest of the script.

After you have been download those 2 file, placed them in the same directory on your server lets say /opt/reports
and make sure you give them a permission
# chmod +x /opt/reports/*

now all left to do is to run the script
# /opt/reports/
and check you mailBox.
you can also add the script to corntab to run in your own scheduling

And please comment (-;