procmail
[Top] [All Lists]

Re: still problems with environment variables

1997-10-02 14:48:07
"Denis B. Roegel" <Denis(_dot_)Roegel(_at_)loria(_dot_)fr> writes:
I have rules in which I build incrementally an environment
variable. Then, if the variable is non-empty,
I want to use its value as a parameter to an external program,
and get the result back. Here is an excerpt of my rules :


---------------------------------
FOUND="" 

:0 c:
* (^TO|^From.*)johnny
johnny
 :0A
 { FOUND="$FOUND johnny" }

:0
* ! FOUND ?? \<\>
|echo $FOUND >> found.list
---------------------------------

Questions :

1) the test `! FOUND ?? \<\>' does not seem to work ; what I want
to do is to test whether $FOUND is different to "" ; how should
I do it ?

If it's not empty, then it contains at least one character:

        :0
        * FOUND ?? .
        |echo $FOUND >>found.list

There are other more obscure ways to do it, of course.


2) the echo command seems to work, provided the condition is true ;
 now, suppose I want to call `myprogram' with parameter $FOUND,
 and get the result back in RESULT, how do I do it ?

        :0
        * FOUND ?? .
        RESULT=| myprogram $FOUND

The stdout of myprogram will be captured at stored in the variable
RESULT.


Philip Guenther

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