Script question

Lt. Commander listmgr at
Mon Jun 22 00:56:28 UTC 2015

To: freebsd-questions at
Subject: Re: Script question

Polytropon wrote:
> Or if you want to omit the grep call:
> awk '/spam=YES/ {print $11}' /var/log/maillog | sort | uniq | sed -e 
> 's/^.*=//' > /tmp/spam-ip.txt
> And then continue:
> cat /tmp/spam-ip.txt >> /usr/samba/mail/envelope cat /tmp/spam-ip.txt 
> | mail -s "SPAM IPs...." at
> Finally, you can easily remove /tmp/spam-ip.txt.

You could even take this one step further and eliminate the need for a
temporary file altogether by making use of tee(1):

    awk '/spam=YES/ {print $11}' /var/log/maillog |
    sort |
    uniq |
    sed -e 's/^.*=//' |
    tee -a /usr/samba/mail/envelope |
    mail -s "SPAM IPs...." at


Hi list!

The script guys were very helpful in smoothing out my sh shell script and it
with other script calls are doing the job I needed.

BUT! I took the snippet below to use as an "yes/no" intro to one of the
calls. It must have aged as is because it complains about badly placed "()s"
right near the top of the intro and I suspect it won't agree with another
line further down either.

Perhaps a hint from the experts as to how to change the problem?

Thank you!


More information about the freebsd-questions mailing list