UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old September 16th, 2004, 11:41 AM
spakment spakment is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 spakment User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Accessing email text sent from Sendmail in a Shell script

Hi
I'm new to shell scripting, and can't find the answer to this in any documentation.

I have set up Sendmail to redirect mail onto a shell script. My question is;
how do I then access the email text to process it within the script?

Is there an environment variable for accessing passed in text, I'm assuming it would be treated the same as text entered via stdin, would something like $* or $@ work (I know these are meant for arguements)?

or is there a way to load in any passed on info into a variable something like
variable=stdin

Thanks in advance for any replies
David

Reply With Quote
  #2  
Old September 16th, 2004, 12:29 PM
Perderabo Perderabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 121 Perderabo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 5
"man aliases" should tell you how to send mail into a program.

In a ksh or bash script you can read from stdin with:
read line
which reads one line into the variable $line. You would probably use a loop something like:

while read line ; do
echo line = $line
done

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Accessing email text sent from Sendmail in a Shell script


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway