Gaffaweb > Love & Anger > 1991-20 > [ Date Index | Thread Index ]
[Date Prev] [Date Next] [Thread Prev] [Thread Next]


exploding love hounds script

From: stern@chem.nwu.edu (Charlotte Stern)
Date: Thu, 13 Jun 1991 13:53:11 -0800
Subject: exploding love hounds script
To: rpeck@jessica.stanford.edu
Cc: love-hounds@eddie.mit.edu

OK.  Here's how the lovehounds digest expander works.
There are three executable scripts involved.
Let's assume they are in your directory ~/lib
and that this is on your path.  The three scripts
are:

1) lh
2) genmail1
3) genmail2

They work as follows:
Every time you receive a digest, you save/append it to
a file named, simply 'lh' in a directory called ~/mail
(where ~ indicates your home directory).  When you have saved
all the digests you want to read in lh, exit your mailer.
Now, simply issue the command 'lh'.  This will invoke the
lh script in your ~/lib directory.  This script uses the
other two scripts, genmail1 and genmail2 (these are really just
inputs to sed) to explode the digests.  The exploded version
is placed in a file called 'lh.mail' in your ~/mail directory.
The 'lh' file is deleted.  And your mailer is invoked on
'lh.mail', so you are instantly able to read lovehounds.
This script can be used even if an 'lh' file doesn't exist 
(e.g. if you save your digests in 'lh', then read a few
entries, then exit, to recommence reading love hounds, just
type lh and it will detect everything automatically and will
put you back where you left off).  Further, if you already have
an 'lh.mail' file in existence with stuff you haven't finished reading
and a new love hounds digest comes in, just follow the same steps
as above (save digest in file 'lh', execute lh) and the script
will automatically append the new digest entries to the ones you
haven't finished reading yet.  

Should you type 'lh' when there is neither a new digest,
nor any old ones you haven't read yet, the script just says
"no new love hounds".  Very convenient.

Of course you can modify the script if you like to keep things
in other directories.  Right now my mailer is called "mailx" so
you should change that to "mail" if your mailer is called that,
or to whatever your unix mailer is called.

Let me know if you have any questions.  If you're not familiar 
with unix mail, you should type "man mail", and read through
the explanation of the -f option, which the script uses.
You might also check up on the sed command: "man sed".

Here are the only three files you should need:

---------------------------lh-----modify if necessary-----cut here----
#! /bin/csh -f
cd ~/mail
if (-e lh) then 
   sed -f ~/lib/genmail1 lh | sed -f ~/lib/genmail2 | cat >>! lh.mail 
   rm lh
endif
if (-e lh.mail) then 
   mailx -f lh.mail
   else echo No new Love Hounds.
endif
----------------------------end lh-------------------------------------

------------------------------genmail1-----------------------cut here---
1h
/^\[\]/,/^/ G
---------------------------end genmail1----------------------------------

------------------------------genmail2-----------------------cut here---
/^\[\]/,/^/ d
---------------------------end genmail2----------------------------------

Good luck!
Hope it works!

-mjm (mike mendelson)