procmail
[Top] [All Lists]

Re: stripping MATCH's right hand side

2001-12-08 14:34:02
When I suggested,

| >  :0
| >  * ^List-Unsubscribe:.*leave-isp-\/(_dot_)*(_at_)(_dot_)*isp-lists(_dot_)com
| >  isp-`ksh -c 'echo ${MATCH%%-*}'`

Paul Chvostek answered,

| Isn't that an even larger footprint?  If you run ksh inside a backquote,
| you're running ksh inside your shell.

Good point, because the asterisk makes procmail invoke a shell and in that
example $SHELL was already /bin/ksh; maybe if I'd unset SHELLMETAS
temporarily, that wouldn't happen.  But unsetting SHELLMETAS is something to
do when we want no shells instead of one, not when we want one instead of
two.

| You'd probably want that action to be merely:
|
| isp-`echo "${MATCH%%-*}"`

Right, because the asterisk already brings a shell up.  Well, actually, as I
posted later,

 isp-`echo ${MATCH%-*(_at_)*}`

| Heck, couldn't we even make sed the shell?

I don't think so, because sed can't run other programs.

| oldSHELL="$SHELL"
| SHELL="/usr/bin/sed -e 's/-[^-][^-]*(_at_)(_dot_)*$//'"
| :0
| * ^List-Unsubscribe:.*leave-isp-\/(_dot_)*(_at_)(_dot_)*isp-lists(_dot_)com
| isp-`"$MATCH"`
| SHELL="$oldSHELL"

| Could we make SHELL=/usr/bin/sed and have the backquoted
| text contain everything needed to make the substitution?

Well, with no characters from $SHELLMETAS on the line, no shell will be
invoked, plus you would also have to unset or adjust $SHELLFLAGS.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail