Hello
I have a simple lookup table as follows:
Using Procmail, if I receive an email for bedrock.com, I want to check to see if it needs redirecting based on the information in my lookup table. I'm unsure of the best method.
I tried egrep and awk but neither can accept a pattern from stdin, so I wrote a shell script (alias.bedrock is the lookup table):
Code:
#!/bin/sh
awk "/$1/ {print \$2}" alias.bedrock
However, I don't know how to get procmail to pass the 'user@' portion of the address to the shell script. My recipe starts something like this:
Code:
:0 wc:
* ^X-Original-To:.*@bedrock.com
| ./<script> (user@) alias.bedrock | $SENDMAIL
As you can see, I somehow need to capture the value of .* in the regular expression and pass it to my script.
1. Is this the best method to achieve this?
2. Is anyone able to offer some assistance please?
Many thanks,
Steve
