Книга: Linux Network Administrator Guide, Second Edition

A Simple Rule Pattern Example

A Simple Rule Pattern Example

To better see how the macro substitution patterns operate, consider the following rule lefthand side:

$* ‹ $+ ›

This rule matches "Zero or more tokens, followed by the ‹ character, followed by one or more tokens, followed by the › character."

If this rule were applied to [email protected] or Head Brewer ‹ ›, the rule would not match. The first string would not match because it does not include a ‹ character, and the second would fail because $+ matches one or more tokens and there are no tokens between the ‹› characters. In any case in which a rule does not match, the righthand side of the rule is not used.

If the rule were applied to Head Brewer ‹ [email protected] ›, the rule would match, and on the righthand side $1 would be substituted with Head Brewer and $2 would be substituted with [email protected].

If the rule were applied to ‹ [email protected] › the rule would match because $* matches zero or more tokens, and on the righthand side $1 would be substituted with the empty string.

Оглавление книги


Генерация: 0.049. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз