Script question

Polytropon freebsd at edvax.de
Mon Jun 22 01:10:48 UTC 2015


On Sun, 21 Jun 2015 16:32:04 -0500, Lt. Commander wrote:
> To: freebsd-questions at freebsd.org
> 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...." us.navy at outlook.com
> > 
> > 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...." us.navy at outlook.com
> 
> Patrick
> _______________________________________________
> 
> 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?

To be honest, I don't see any ( or ) in the whole script.
Can you post your _current_ version, just to be sure we're
looking at the same code? Every other attempt probably is
just guesswork...




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list