How can I get the list of local domains from a forward file?
An example of /etc/exim4/forwards
:
[email protected]: [email protected]
# ignore this line
[email protected]: [email protected]
[email protected]: [email protected]
Here the string expansion (or what ever it's called g) should return test.com : hugo.com
.
I assume it can be done with readfile
and map
, but I can't get it to work.
I have something that almost works the way you want it. What this expansion does is:
I don't profess this to be exactly what you need, but it shows how the lists can be parsed and grep'd.
If you spread out the expansion logically into its individual parts, it looks like this:
One thing that still needs to be fixed is that leading : should not be there. I'm not 100% sure why it is there :-/ and I don't really have the time to delve any further into it. The logic needs to be massaged a bit to catch whatever condition is causing that leading colon to appear and then the result should be a domain list that you can use as a condition.