[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: procmail recipe/bash scripting issue



On 26 Jan 2004, Matt Price <matt.price@utoronto.ca> wrote:
> So I asusme the script is running, but it's not receiving the data it
> needs, or at least not understanding it.  
> 
> Here's the script, which as ou see is very primitive:  
> ----------------------------------
>  cat /usr/local/scripts/moviepage 
> #!/bin/bash
> 
> TITLE=`formail -x"Subject:" < "$@"` ;
> HEADER="<h2>$TITLE</h2>";
> FROM=`formail -x"From:" < "$@"` ;
> BYLINE="<h3>$FROM</h3>";
> BODY=`formail -I "" < "$@"`;
> TEXT="<p>$BODY</p>";
> echo "$HEADER" >> /www/derailleur.org/movies.html;
> echo "$BYLINE" >> /www/derailleur.org/movies.html;
> echo "$TEXT" >> /www/derailleur.org/movies.html;
> -----------------------------------
> 
> soooo... am I using the $@ wrong somehow?  should I substitute
> somethng else?  

Procmail sends the message via STDIN, so you would have to read it from
there. As you have to read the message more than once for the different
formail calls, it would probably be best to save the message in a
temporary file and read it from there afterwards. So put a 

  msg=`tempfile`; cat > "$msg"

on top of your script and replace all $@'s with $msg. Don't forget to
delete $msg when your done.

-- 
Philipp Weis          pweis@pweis.com
Freiburg, Germany     http://pweis.com/



Reply to: