The UNIX and Linux Forums  


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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sending mail parmeet UNIX for Dummies Questions & Answers 11 05-13-2009 04:37 AM
help sending mail mierdatuti Ubuntu 2 01-09-2009 02:51 PM
hp ux not sending mail kkhan HP-UX 3 01-31-2008 11:27 PM
sending mail mskarica UNIX for Advanced & Expert Users 3 04-12-2005 09:59 AM
sending a mail to a mail client solaris73 UNIX for Dummies Questions & Answers 5 11-18-2002 01:58 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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.
  #2 (permalink)  
Old 05-26-2009
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,577
var1=$(df -k | awk '{print $1 " " $5}')
  #3 (permalink)  
Old 05-27-2009
Sirisow5 Sirisow5 is offline
Registered User
  
 

Join Date: May 2009
Posts: 2
sorry.. still facing the issue with that. Encountered the error like unexpected '('. I've used following command:
var1=$(df -k | awk '{print $1 " " $5}')

Please suggest...

-----Post Update-----

I resolved this issue by redirecting the value to another text file.
  #4 (permalink)  
Old 05-27-2009
alberto alberto is offline
Registered User
  
 

Join Date: May 2009
Posts: 14
df -k | awk '{print $1 " " $5}' | mail -s "FILE SYSTEM USAGE"

Last edited by vbe; 05-27-2009 at 05:35 AM.. Reason: removed Email
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0