O'Reilly logo

Sendmail, 3rd Edition by Bryan Costales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The RHS

The purpose of the RHS in a rule is to rewrite the workspace. To make this rewriting more versatile, sendmail offers several special RHS operators. The complete list is shown in Table 18-2.

Table 18-2. RHS operators

RHS

§

Description or use

$digit

Section 18.7.1

Copy by position

$:

Section 18.7.2

Rewrite once (when used as a prefix), or specify the user in a delivery-agent "triple," or specify the default value to return on a failed database-map lookup

$@

Section 18.7.3

Rewrite and return (when used as a prefix), or specify the host in a delivery-agent "triple", or specify an argument to pass in a database-map lookup or action

$>set

Section 18.7.4

Rewrite through another rule set (such as a subroutine call that returns to the current position)

$#

Section 18.7.5

Specify a delivery agent or choose an action, such as to reject or discard a recipient, sender, connection, or message.

$[ $]

Section 18.7.6

Canonicalize hostname

$( $)

Section 23.4

Perform a lookup in an external database, file, or network service, or perform a change (such as dequoting), or store a value into a macro.

$&

Section 21.5.3

Delay conversion of a macro until runtime

Copy by Position: $digit

The $digit operator in the RHS is used to copy tokens from the LHS into the workspace. The digit refers to positions of LHS wildcard operators in the LHS:

R $+ @ $*    $2!$1
      $1           $2 

Here, the $1 in the RHS indicates tokens matched by the first wildcard operator in the LHS (in this case, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required