procmail
[Top] [All Lists]

Re: Adding fields conditionally to formail call?

1998-01-15 15:40:39
On 14 Jan 1998 jari(_dot_)aalto(_at_)poboxes(_dot_)com wrote:
   Does anyone have ideas how I can "stack" th3e fieds before I
   call formail. I'm trying to minmize the called formail processes,
...
   But I'd like to call formail only onece with all headers in variables,
   like this

       field1 = ""     field2 = ""
       :0
       * flag1 ?? yes
       { field1 = "-A \"X-header1: value\"" }

       :0
       * flag2 ?? yes
       { field2 = "-A \"X-header2: value\"" }


       # Call only formail once with all headers known
       :0
       | formail -A "X-my: required" $field1 $field2
               

   But, This doesn't work, see log below.Ideas?
   jari


procmail: Executing "formail,-A,X-my: 
required,-A,"X-header1:,value",-A,"X-heade
r2:,value""
procmail: Assigning "LASTFOLDER=formail -A X-my: required -A "X-header1: 
value" 
-A "X-header2: value""
Usage: formail [-bczfrktqY] [-D nnn idcache] [-p prefix] [-l folder]
       [-xXaAiIuU field] [-R ofield nfield]

I've had success using Bourne-shell variable substitution:

        field1='X-header1: value'
        field2='X-header2: value'

        :0fhw
        |formail ${field1:+-A"$field1"} ${field2:+-A"$field2"}

David Hunt


<Prev in Thread] Current Thread [Next in Thread>