Re: bash script for iptables
From: William Park (opengeometry_at_yahoo.ca)
Date: 07/26/04
- Previous message: Jem Berkes: "Re: Question about a (spam-)bot that creates subdirectories in /tmp"
- In reply to: Felix Tilley: "bash script for iptables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 26 Jul 2004 20:07:17 GMT
Felix Tilley <ftilley@localhost.localdomain> wrote:
> !/bin/bash
> # 10 JUN 2004
>
> # Must be run as root
>
> grep "localhost kernel" /var/log/syslog|grep PROTO|while read a1 a2 a3
> a4 a5 \ a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20
>
> do
> if test $a16 = "PROTO=UDP"
> then echo $a1 $a2 $a3 "-0700" $a9 $a10 $a16 $a17 $a18
> else echo $a1 $a2 $a3 "-0700" $a9 $a10 $a17 $a18 $a19
> fi
> done
More sensible way of doing this kind of thing is
grep ... | sed ... | while read line; do
( declare $line # 'line' only has VAR=VALUE or VAR strings
if [ $PROTO = UDP ]; then
echo ...
else
echo ...
fi )
done
-- William Park, Open Geometry Consulting, <opengeometry@yahoo.ca> Toronto, Ontario, Canada
- Previous message: Jem Berkes: "Re: Question about a (spam-)bot that creates subdirectories in /tmp"
- In reply to: Felix Tilley: "bash script for iptables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]