Portál AbcLinuxu, 13. července 2025 18:41
SPAM = ${HOME}.Spam/ THRESH=6 `test -d $HOME` if ( $RETURNCODE == 1 ) `maildirmake $HOME` if ( /^X-Spam-Score: *![:digit:]+!\./ ) { if ( $MATCH2 >= $THRESH ) { `test -d $SPAM` if ( $RETURNCODE == 1 ) `maildirmake $SPAM` exception { to $SPAM } } exception { to $HOME } }z manu (fbsd rel):
PATTERN MATCH RESULTS After a pattern is successfully matched, the actual text that is matched is placed in the MATCH variable. For example: /^From:.*/ matches a line of the form: From: postmaster@localhost Here the variable MATCH will be set to "From: postmaster@localhost", which can be used in subsequent statements. If the pattern contains subpatterns, the portions of the text that match the first subpattern is placed in the MATCH1 variable. The sec- ond subpattern, if any, is placed in MATCH2, and so on: /^From:\s+(.*)@(.*)/ matched against the same line will set MATCH to ``From: postmas- ter@localhost'', MATCH1 to ``postmaster'', and MATCH2 to ``localhost''. Of course, in real world the ``From:'' header is usually much more com- plicated, and can't be handled that easily. This is just an illustra- tive example. Note: Subpatterns are not processed in the foreach statement.RTFM covece. nerikej mi ze se tim zivis
LIMIT=1 MAILDIR=$DEFAULT SPAMDIR=$DEFAULT/.Spam `test -d "$MAILDIR"` if ($RETURNCODE == 1) { `mkdir -p $MAILDIR` `rmdir $MAILDIR` `maildirmake $MAILDIR` } if (/^X-Spam-Score: *([0-9]+)/) { if ($MATCH1 >= $LIMIT) { `test -d "$SPAMDIR"` if ($RETURNCODE == 1) `maildirmake $SPAMDIR` exception { to $SPAMDIR } } }
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.