procmail screwup -- mea culpa

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

 



Aw, shucks, Chuck. thanks for the lean and mean version! <grin>
How did you know I was cleaning my mail out today??


Charles Hallenbeck writes:
> From: Chuck Hallenbeck <chuckh at mhonline.net>
> 
> I answered Bill's request for a procmail recipe a few days ago
> and posted some incorrect information. Damn! I was sure it was
> right! I have been using procmail recipes of a very simple sort
> for a while and have recently been trying to fancify and simplify
> them. Basically I have been using the plain vanilla three liners
> like this:
> 
> line 1. :0: or :0 c
> line 2. * pattern, or * !pattern
> line 3. | command, or destination (without the '|')
> 
> Often what I have been doing is to detect a pattern and then play
> a particular sound file and route the message to a particular
> folder. That has been taking me six statements using the above
> methods, because only one action per recipe is permitted. It has
> worked like this:
> 
> line 1. :0 c
> line 2. * pattern
> line 3. | play the sound
> line 4. :0:
> line 5. * the same pattern
> line 6. foldername
> 
> The difference between line 1 and line 4 is that line 1 makes a
> carbon copy of the message in case the pattern succeeds, so it
> remains available for subsequent recipes, while line 4 does not,
> in effect swallowing the message if the pattern succeeds.
> 
> This has been working fine, but it is not too neat because the
> same pattern has to be matched twice: once to play the sound and
> a second time to route the message. What I posted a few days ago
> was intended to do the same thing without repeating the pattern
> match and it was incorrect. What I should have posted required 8
> lines like this:
> 
> line 1. :0:
> line 2. * pattern
> line 3. {
> line 4. :0 c
> line 5. | play the sound
> line 6. :0:
> line 7. foldername
> line 8. }
> 
> Meanwhile there is even a simpler way to do this. (and this time
> I know for sure it works) and now we are down to five lines but
> with a single pattern match.
> 
> line 1. :0 c
> line 2. * pattern
> line 3. | play the sound
> line 4. :0 A
> line 5. foldername
> 
> The trick here is the ":0 A" on line 4, which says in effect
> "only do this recipe if the last recipe produced a match", and so
> no further pattern matching is necessary in this second recipe.
> It is just ignored if the first recipe failed, and swallows the
> message if it had succeeded.
> 
> Sorry Bill, but fill in the blanks on this one and you will have
> a winner.
> 
> Chuck
> 
> 
> 
> 
> -- 
> The Moon is Waning Gibbous (86% of Full)
> So visit me sometime at http://www.mhonline.net/~chuckh
> 
> 
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup

-- 
	
				Janina Sajka, Director
				Technology Research and Development
				Governmental Relations Group
				American Foundation for the Blind (AFB)

Email: janina at afb.net		Phone: (202) 408-8175




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux