pipeto.sample

来自「这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易」· SAMPLE 代码 · 共 74 行

SAMPLE
74
字号
#!/bin/rc# create a /tmp for here documentsrfork enbind -c /mail/tmp /tmpKEY=whocaresUSER=kenRECIP=$1MBOX=$2PF=/mail/box/$USER/_patternTMP=/mail/tmp/mine.$pidBIN=/bin/upasD=/mail/fs/mbox/1# save and parse the mail file{sed '/^$/,$ s/^From / From /'; echo} > $TMPupas/fs -f $TMP# if we like the source# or if the subject contains a valid token# then deliver the mail and allow all the addressesif( $BIN/list check $PF $D/from $D/sender $D/replyto ){	$BIN/deliver $RECIP $D/from $MBOX < $D/raw	$BIN/list add $PF $D/from $D/to $D/cc $D/sender	rm $TMP	exit 0}switch($status){case *!match*	echo `{date} dropped $RECIP From `{cat $D/replyto} >> /mail/box/$USER/_bounced >[2] /dev/null	rm $TMP	exit 0}if ( $BIN/token $KEY $D/subject ){	$BIN/deliver $RECIP $D/from $MBOX < $D/raw	$BIN/list add $PF $D/from $D/to $D/cc $D/sender	rm $TMP	echo `{date} added $RECIP From `{cat $D/replyto} \		>> /mail/box/$USER/_bounced >[2] /dev/null	exit 0}# don't recognize the sender so# return the message with instructionsTOKEN=`{upas/token $KEY}upasname=/dev/null{{cat; cat $D/raw} | upas/send `{cat $D/replyto}}<<EOFSubject: $USER's mail filterI've been getting so much junk mail that I'm resorting toa draconian mechanism to avoid the mail.  In orderto make sure that there's a real person sending mail, I'masking you to explicitly enable access.  To do that, sendmail to $USER at this domain with the token:	$TOKENin the subject of your mail message.  After that, youshouldn't get any bounces from me.  Sorry if this isan inconvenience.----------------Original message----------------EOFecho `{date} bounced $RECIP From `{cat $D/replyto} \	>> /mail/box/$USER/_bounced >[2] /dev/nullrv=$statusrm $TMPexit $status

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?