The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-26-2009
Sirisow5 Sirisow5 is offline
Registered User
  
 

Join Date: May 2009
Posts: 2
Need help in sending data through mail

Hello there,

I'm trying to send the data stored in a variable through a mail as body of the mail. But not able send the data through mail.

Here is my code:

var1= df -k | awk '{print $1 " " $5}'
echo "This is the alert msg" > mail_body.txt
echo "$var1" >> mail_body.txt
SENDER=test@t.com
RECIPIANTS=test1@t.com
mailx -s "Subject - mail subj" -r ${SENDER} ${RECIPIANTS} < mail_body.txt

Whenever I'm running the script, the recepiant is receivng mail with the body "This is the alert msg'. But not able to receive the data in "var1".

Your help is more appreciate.