Alright, so I have been asked to help with this script. Basically what it needs to do is email a user if there is an error associated with an ID. Now I won't go into too much detail on that because the sql portion does that correctly. What I don't know how to do is pull out each user email from the sql individually and email them one at a time then attach the error ticket associated with it to the email body.
My KSH script as I have it now.
#!/usr/bin/ksh # sets all environment variables . /data/pmes/pmes/pmes_scripts/pmes_Env_Var.config # sets the results of the .sql file to the emailBody Variable emailBody=`sqlplus -s $USERID/$PPASSWD@$DATABASE @/data/pmes/pmes/pmes_scripts/testingmail2.sql` # these email addresess are emailed when the script completes MAIL_ID='emailme@yoursite.com' (echo "$emailBody")|mailx -s "Test Email`" $MAIL_ID
Output of echo $emailBody
aaron.heckel@yoursite.com 20140801_BR_Bob,D_PZXKGX steve.naman@yoursite.com 20140816_AM_Andrew,D_PZXKGX
(It is basically email then the issue ID. Each item has a space in between them)
Any help would be appreciated. I'm very new with mailing and sqlplus in UNIX.