我如何从前向文件获取本地域列表?
/etc/exim4/forwards
一个例子:
[email protected]: [email protected] # ignore this line [email protected]: [email protected] [email protected]: [email protected]
这里的string扩展(或者称之为g )应该返回test.com : hugo.com
。
我认为这可以用readfile
和map
来完成,但是我无法得到它的工作。
我有些东西几乎像你想要的那样工作。 这个扩展做的是:
我不认为这是你所需要的,但它显示了如何parsing和grep'd列表。
CentOS58[root@ivwm41 exim]# more test_list.cf [email protected]: [email protected] # ignore this line [email protected]: [email protected] [email protected]: [email protected] CentOS58[root@ivwm41 exim]# exim -be '${reduce {<; ${readfile{/etc/exim/test_list.cf}{;}} } {} {${if or{ {match{$item}{#}} {match{$item}{#}} } {$value} {$value:${sg {${extract{1}{:}{$item}}} {^.*@}{} }}}}}' :test.com:test.com:hugo.com
如果您将扩展逻辑分散到各个部分,则看起来像这样:
exim -be '${reduce {<; ${readfile{/etc/exim/test_list.cf}{;}} } {} {${if or{ {match{$item}{#}} {match{$item}{#}} } {$value} {$value:${sg{${extract{1}{:}{$item}}} {^.*@} {}}}} } } '
还有一点需要解决的是领导:不应该在那里。 我不是100%肯定它为什么在那里: – 我真的没时间深入研究它。 需要对逻辑进行一点处理,以捕捉导致冒号出现的任何情况,然后结果应该是可以用作条件的域列表。