Re: [Exim] conditions in filters

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Ian Southam
CC: Paul Slootman, exim-users
Tárgy: Re: [Exim] conditions in filters
On Fri, 12 May 2000, Ian Southam wrote:

> On Fri, May 12, 2000 at 11:10:49AM +0200 Paul Slootman wrote :
>
> > > if "${if exists{/some/file}{yes}{no}}" is "yes" then ...
> >
> > Argh, I had not realized the quote around the whole ${if part was
> > necessary. Maybe some explicit examples of this stuff should be included
> > in the filter docs (or the filter part of the FAQ); I had looked but
>
> I'd actually agree. I am pretty au fait with these things now but, when I
> first started with exim a couple of years ago, it took me about 20 attempts
> to get the syntax for these things right. Even now, I don't think I have ever
> put one in that "worked" first time ;-).


The expansion strings are messy. However, for filters it is simple. Any
data string (i.e. anything other than a filter keyword) must be quoted
if it contains white space. From "Exim's user interface to mail
filtering":


5. Format of filter files

...

The remainder of the file is a sequence of filtering commands, which
consist of keywords and data values, separated by white space or line
breaks, except in the case of conditions for the "if" command, where round
brackets (parentheses) also act as separators.

...

There are two ways in a data value can be input:

 .   If the text contains no white space then it can be typed verbatim.
     However, if it is part of a condition, it must also be free of round
     brackets (parentheses), as these are used for grouping in conditions.


 .   Otherwise it must be enclosed in double quotation marks. In this case,
     the character \ (backslash) is treated as an 'escape character' within


...



-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.