$#

Match a literal $# LHS operator

Because the RHS can return a delivery agent specification, it is sometimes desirable to check for the $# operator on the LHS of a rule. Consider, for example, the following rule:

R $+ $|  $# OK              $@ $1

The LHS looks for anything (the $+) followed by a $| operator, and then $# OK. This might match a workspace that was set up by a database-map lookup or a call to another rule set. The $# OK means the address was OK as is, and so should be placed back into the workspace. The RHS does just that by returning (the $@ prefix) the original address (the $1 references the LHS $+, which contained the original address).

Note that the $# operator has no special meaning in the LHS. It is used only to detect a delivery agent-like specification made by an earlier rule on the RHS. The next two sections reveal how this is done.

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.