[lug] Bletcherous pipe, FIXME!
Andrew Gilmore
agilmore at skybeam.com
Thu Apr 2 16:08:48 MDT 2009
Very cool responses.
I agree that the sed needed alteration. Not sure where the extra space went, but indeed it needed to be
sed -e 's/ */ /'
The echo at the end should have been outside the loop.
hosts.allow needs the dest and the mask, not the gateway, so with this minor change, I like your result:
{
printf "ALL: localhost"
route -n | egrep -v '^(0|169|[A-Z])' | # grab the local
# hosts/masks
while read dest gateway genmask etc; do # turn into
# comma-separated list
printf ", $dest/$genmask"
done
echo # newline on the end
} >> /etc/hosts.allow # tack onto the
# hosts.allow file
More information about the LUG
mailing list