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?
${if eq{${lookup{$domain}lsearch*{/etc/virtual/domainowners}{$value}}}{} {remote}{${lookup{$domain}lsearch*{/etc/virtual/domainowners}{$value}}}}
Note this obviously requires doing linear searching of
/etc/virtual/domainowners twice for the same value. Not good.
(I know I should use CDB format or at least DBM for that, but this is
not dependent on me, /etc/virtual/domainowners is a plain file that is
written by external closed-source software package)
--
Marcin Krol