Stuart Gall <stuart@???> wrote:
> In the docs a mysql example is
> ${lookup mysql{select mailbox from users where id='userx'}\
> {$value}fail}
> I find ${lookup mysql{select mailbox from users where id='userx'}}
> returns the data just fine.
> What are the $value and fail for ?
http://www.exim.org/exim-html-4.63/doc/html/spec_html/ch11.html#id2559093
| ${lookup{<key>} <search type> {<file>} {<string1>} {<string2>}}
[...]
| ${lookup <search type> {<query>} {<string1>} {<string2>}}
[...]
| If the lookup succeeds, <string1> is expanded and replaces the entire
| item. During its expansion, the variable $value contains the data
| returned by the lookup. Afterwards it reverts to the value it had
| previously (at the outer level it is empty). If the lookup fails,
| <string2> is expanded and replaces the entire item.
[...]
| Instead of {<string2>} the word "fail" can appear, and in this case,
| if the lookup fails, the entire expansion is forced to fail (see
| section 11.4). If both {<string1>} and {<string2>} are omitted, the
| result is the looked up value in the case of a successful lookup, and
| nothing in the case of failure.
So the difference is when the lookup fails. - "Your" variant returns
an empty string, the other one a forced failure.
------------------------
ametzler@argenau:~$ /usr/sbin/exim4 -be
> ${lookup{root} lsearch{/etc/aliases}}
ametzler
> ${lookup{root} lsearch{/etc/aliases}{$value}fail}
ametzler
> ${lookup{rootx} lsearch{/etc/aliases}}
> ${lookup{rootx} lsearch{/etc/aliases}{$value}fail}
Failed: "lookup" failed and "fail" requested
------------------------
cu andreas
--
The 'Galactic Cleaning' policy undertaken by Emperor Zhark is a personal
vision of the emperor's, and its inclusion in this work does not constitute
tacit approval by the author or the publisher for any such projects,
howsoever undertaken. (c) Jasper Ffforde