Calling one script inside another

Hi,

I am calling a script log.sh from output.sh.
Log.sh has below pice of code:

 
IFILE=/home/home1/Report1.csv
if  awk -F, '$6==0 && $7==0{exit 1}' ${IFILE}
then
  awk -F, '
    BEGIN{
     c=split("1,6,2,3,4,5,6", col)
     print "To: abc@gmail.com"
     print "Subject: Error report"
     print "MIME-Version: 1.0"
     print "Content-Type: text/html"
     print "Content-Disposition: inline\n"
     print "<HTML><TABLE border=1>"
     print "<TH>Heading 1</TH><TH>Heading 2</TH><TH>Heading 3</TH>"
     print "<TH>Heading 4</TH><TH>Heading 5</TH><TH>Heading 6</TH>"
     print "<TH>Heading 7</TH>"
    }
    NR>4 {
     printf "<TR>"
     for(i=1;i<=c;i++) printf "<TD>%s</TD>", $col
     print "</TR>"
    }
    END{
      print "</TABLE></BODY></HTML>"
    } ' ${IFILE} | sendmail -t
fi

Output.sh has below pice of code:

 
log=/home/va59657
rndt=`date "+%Y%m%d"`
OFILE1="${log}/${rndt}.log"
echo "                       REPORT                                                  " >> $OFILE1
echo "                                                                                                                                        " >> ${OFILE1}
echo "                                                                                                                                        " >> ${OFILE1}
echo "###################################################################################################################################" >> $OFILE1
echo "                                                                                                                                        " >> ${OFILE1}
 
/home/va59657/log.sh >> $OFILE1
cat $OFILE1 | mail -s "Report" abc@gmail.com

However when i am running output.sh i am getting two separate emails with subject Error report and Report.ie output of log.sh(
/home/va59657/log.sh.sh >> $OFILE1)is not going to $OFILE and mail is coming because of sendmail -t command used in log.sh.
When i am removing sendmail -t command in log.sh,html code is coming in email instead of actual output in tabular form from output.sh.

I want only one email with output of log.sh in output.sh mail with subject Report and no two separate emails.
Please help.

You are getting two mails because both of your scripts send mails... You are getting HTML output because your script prints HTML... If you just want the inner script to dump the file to stdout, use cat:

Also, isn't that the awk script you were complaining didn't work in the other thread?

IFILE=/home/home1/Report1.csv
awk -F, '$6==0 && $7==0{X=1} END {exit(X+0); }' ${IFILE} && cat ${IFILE}

Thanks.i am using this code as I have only one row in the file..
The other code was perfectly working for all the cases.
But I want HTML output only but through email sent by output.sh.
When I am removing sendmail -t command from log.sh I am getting one email but instead of getting correct HTML output I am getting HTML code printed instead of correct HTML output.