sendmail Desktop Reference

sendmail Desktop ReferenceSearch this book
Previous: 2.15 Operators that Return a TripleChapter 2
The sendmail.cf File
Next: 2.17 Hints
 

2.16 Conditional Operators

Conditional operators allow text to be inserted that depends on the value in a macro. Conditional operators are never used in rules, but are often used in header definitions (see §31.6).

$?macro result $| alternate $.

If the macro has a value, the entire expression is replaced by result. Otherwise, the entire expression is replaced by alternate. For example:

From: $?x$x <$g>$|$g$.

Here, if $x has a value (the $?x), the entire expression becomes:

From: $x <$g>

Otherwise (the $|$g), it becomes:

From: $g

The $. is last and terminates the conditional expression. Conditional expressions may nest, but nesting is discouraged.


Previous: 2.15 Operators that Return a Triplesendmail Desktop ReferenceNext: 2.17 Hints
2.15 Operators that Return a Triple 2.17 Hints