<<< Date Index >>>     <<< Thread Index >>>

Re: multi fcc



On Fri, Jan 09, 2004 at 09:20:41AM +0100, Przemyslaw Gawronski wrote:

> > If you need ideas, I can post some sample code to get you started.
> > I'm way too lazy to do the whole thing, though.
> 
> Yes please, that would be very helpfull.

Okay, okay:

#!/bin/sh

file=$1

if egrep "^To:.* blah@xxxxxxx" >&/dev/null ; then
 blah_goo_gaa=1
fi

if egrep "^To:.* wawa@xxxxxxxx" >&/dev/null ; then
 wawa_mama_dad=1
fi

if [ "$blah_goo_gaa$wawa_mama_dad" = "11" ] ; then
 echo -e "1i\nFcc: =sent-mail\n.\nwq" | ed $file
elsif [ "$blah_goo_gaa" ] ; then
 echo -e "1i\nFcc: =blah_goo_gaa\n.\nwq" | ed $file
elsif [ "$wawa_mama_dad" ] ; then
 echo -e "1i\nFcc: =wawa_mama_dad\n.\nwq" | ed $file
fi

vi $file


You'll notice that we first establish variables for the tests.  Next,
we do things based on the variables.  Finally, we call our real editor.
This is the general procedure with practically any $editor script
(except that you'll sometimes want a "cleanup" procedure after calling
the real editor).  I hope that got your mind rolling :-)

 - Dave

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgpXiRQFmG2zS.pgp
Description: PGP signature