I have a BASH script like the below:
#!/bin/bash
email_template="Subject: Subject
From: example@example.com
To: %s
%s
%s
%s
"
cat test.out | while read num email limit orders; do
echo "Sending mail to '$email'"
printf "$email_template" "$email" "$num" "$limit" "$orders" |
sendmail -oi -t
done
Also there is a .sql
file with a SQL query contained within that does a SPOOL to test.out
with results. How can I make it so that this is all done within the BASH script above (SQL in BASH script, no cat
etc.)?