I have the following query:
#!/bin/bash
db="bats";
table="promotion";
dbHost="192.168.0.246";
dbUser="root";
dbPass="root";
result='mysql -h $dbHost --user=$dbUser --password=$dbPass --skip-column-names -e "SELECT name FROM $db.$table WHERE finish > now() ORDER BY promotion_key DESC"'
campanha=$(echo $result | tr " " "\n")
echo "$campanhas"
I want to get this result and send it by email, how would I do this?
I tried this too:
sendmail -s "CAMPANHAS" [email protected] < $campanha
Plus gave the following error:
./query.sh: line 14: $campanha: ambiguous redirect