Shell Script to Export PostgreSQL SQL Query in CSV Format and Emailing it as Attachment

Recently I came across a need to create a Linux shell script to run a PostgreSQL SQL query, export it in CSV Format and send it attached to an email. The following is a self-explanatory Linux shell script outlining the process.


I hope this helped someone.

Facebook Comments