procmail
[Top] [All Lists]

Re: $@ is driving me crazy

1999-03-22 20:05:40
"John D. Hardin" <jhardin(_at_)wolfenet(_dot_)com> writes:
$@ isn't working as documented, and I wonder if anyone can see what I
obviously can't... 
...
LOG="\$(_at_)="
:0 ciw
| echo '{' $@ '}' >> $LOGFILE 2>&1
...

I could have sworn this limitation was documented somewhere in the
manpages, but I can't find it now:

        $@ only expands to procmail's arguments when procmail is
        doing the expanding.  If any characters from $SHELLMETAS
        occur in the command then the expansion is left to the
        shell which does not have that information availible to it.

Work around (untested), if your shell is new enough:

        oSHELLMETAS = $SHELLMETAS
        SHELLMETAS
        :0 ciw
        | $SHELL $SHELLFLAGS 'echo "{ $@ }" >> $LOGFILE 2>&1' "$@"
        SHELLMETAS = $oSHELLMETAS
        oSHELLMETAS

(newer versions of /bin/sh, including POSIX compliant ones should
accept arguments after the -c options argument as values to be placed
in $1, etc)


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>