Re: [exim] expanding variables in macro name

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Ian Eiloart
Date:  
À: Artjom Gora, exim-users
Sujet: Re: [exim] expanding variables in macro name


--On 26 November 2010 22:53:44 +0200 Artjom Gora <dr.tibibo@???>
wrote:

> Hello Ian,
> Thank you for your reply.
>
> I've tried to resolve expansions in such way but it still doesn't work
> as expected.
> After expansion Exim treats 'MACRO1' literally and doesn't look
> what MACRO1 is defined for.
>


That's odd. Macros can be used in alias expansions. See section 6.8 of the
docs, for example:

"As an example of macro usage, consider a configuration where aliases are 
looked up in a MySQL database. It helps to keep the file less cluttered if 
long strings such as SQL statements are defined separately as macros, for 
example:
    ALIAS_QUERY = select mailbox from user where \ 
login='${quote_mysql:$local_part}';


This can then be used in a redirect router setting like this:
    data = ${lookup mysql{ALIAS_QUERY}}


In earlier versions of Exim macros were sometimes used for domain, host, or
address lists. In Exim 4 these are handled better by named lists – see
section 10.5."

> On Wed, Nov 24, 2010 at 12:35 PM, Ian Eiloart <iane@???> wrote:
>>
>>
>> --On 23 November 2010 19:54:57 +0200 Artjom Gora <dr.tibibo@???>
>> wrote:
>>
>>> Hello, exim-users!
>>> Is there are any possibility to expand an arbitrary variable into the
>>> macro name?
>>> For instance, Ihave several macros defined lke this
>>> MACRO1=some data
>>> MACRO2=another data
>>> MACRO3=some other data
>>>
>>> then have acl like this
>>>
>>> warn set acl_c1 = ${some expansion}
>>>
>>> where acl_c1={1..3}
>>>
>>> Can  I  use my macros in the follow way?
>>>
>>> MACRO${acl_c1}
>>
>> I think that won't work, because MACRO expansions occur first. Why not
>> have the expansion resolve to MACRO1, MACRO2, or MACRO3?
>>
>>
>> --
>> Ian Eiloart
>> IT Services, University of Sussex
>> 01273-873148 x3148
>> For new support requests, see http://www.sussex.ac.uk/its/help/
>>
>>




--
Ian Eiloart
IT Services, University of Sussex
01273-873148 x3148
For new support requests, see http://www.sussex.ac.uk/its/help/