Dump a Defined Macro with $

The $ rule-testing command causes sendmail to print the value of a defined sendmail macro. The form for this command looks like this:

$X               ← show value of the single-character macro name X
${YYY}           ← show value of the multicharacter macro name YYY

Only one sendmail macro can be listed per line. If more than one is listed, all but the first are ignored:

$X $Y
    ↑
   ignored

One use for this command might be in solving the problem of duplicate domains. For example, suppose you just installed a new configuration file and discovered that your host was no longer known as here.our.domain, but instead wrongly had an extra domain attached, like this: here.our.domain.our.domain. To check the value of $j ($j on page 830) which should contain the canonical name of your host, you could run sendmail in rule-testing mode:

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> $j
$w.our.domain
>

This looks right because $w ($w on page 850) is supposed to contain our short hostname. But just to check, you could also print the value of $w:

> $w
here.our.domain

Aha! Somehow, $w got the full canonical name. A quick scan of your .mc file (Configure with m4 on page 587) turns up this error:

LOCAL_CONFIG
Dwhere.our.domain           # $w is supposed to be full -- joachim

Apparently, your assistant, Joachim, mistakenly thought the new sendmail was wrong. You can take care of the configuration problem by deleting the offending line and creating a new configuration file. To solve ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.