Re: [exim] String expansion

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Marc Sherman
日付:  
To: exim-users
題目: Re: [exim] String expansion
Marcin Krol wrote:
> Hello everyone,
>
> Following string expansion works:
>
>> ${if eq{${lookup{da7.promo.pl}lsearch*{/etc/virtual/domainowners}{$value}}}{} {remote}{local}}
> local
>> ${if eq{${lookup{not.local.domain}lsearch*{/etc/virtual/domainowners}{$value}}}{} {remote}{local}}
> remote
>
> However, I need to actually get the $value from
> lsearch*{/etc/virtual/domainowners} as return value of entire
> expression (that is, I want to get the domain name if it's local, or
> 'remote' string if it's not local).
>
> The following does _not_ work:
>
> ${if eq{${lookup{$domain}lsearch*{/etc/virtual/domainowners}{$value}}}{} {remote}{$value}}
>
> $value seems to be always empty here.
>
> Is there some smart way of retaining $value from lsearch lookup or do
> I have to resort to the following kludge?


Including a $lookup inside a $if is almost always the wrong thing to do;
$lookup implements its own conditional semantics.

Try this:

${lookup{da7.promo.pl}lsearch*{/etc/virtual/domainowners}{$value}{remote}}

- Marc