Re: [exim] Doc Query : listextract

Top Page
Delete this message
Reply to this message
Author: Adam D. Barratt
Date:  
To: exim-users
Subject: Re: [exim] Doc Query : listextract
On Thu, 2015-09-17 at 18:09 +0100, Always Learning wrote:
> On Thu, 2015-09-17 at 09:10 +0100, Jeremy Harris wrote:
> > On 17/09/15 04:07, Always Learning wrote:
> > > exim.org/exim-html-current/doc/html/spec_html/ch-string_expansions.html
> > >
> > >
> > >> ${listextract{-3}{<, x,42,99,& Mailer,,/bin/bash}{result: $value}}

[...]
> > But your "-1"th field runs from the "&" onwards,
> > because of the rules on doubled list separators.

[...]
> Queries:
>
> (1) Are there 2 strings ?
> x,42,99,
> Mailer,,/bin/bash


You could just test it - "exim -be" is your friend. There are four
strings:

1 - x
2 - 42
3 - 99
4 - & Mailer,/bin/bash

> (2) If so, then the resulting combined string will be: x,42,99,Mailer,,/bin/bash
> with 6 items including item 5 a null entry.
>
> (3) If -1 means the right-most item, then that item will be
> '/bin/bash', so how does -3 produce anything except 'Mailer' ?
>
> (4) Or does '<,' apply only to the first of the 2 strings even thought
> it and the two strings are enclosed in the same pair of round brackets
> ? Does a '&' negate the effect of the '<,' ?


It's nothing to do with the "&" and everything to do with the data
containing the list separator, as Jeremy mentioned.

http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_run_time_configuration_file.html#SECTempitelis indicates that:

"For example, this list contains three items, the second of which is
empty:

senders = user1@domain : : user2@domain

Note: There must be white space between the two colons, as otherwise
they are interpreted as representing a single colon data character (and
the list would then contain just one item)"

The two commas between "& Mailer" and "/bin/bash" don't represent an
empty item between those two strings. Rather, they represent a single
"escaped" comma which forms part of the string "& Mailer,/bin/bash".

Regards,

Adam