This is my ipset shell script file like this

for IP in $(wget -O /var/geoiptest.txt http://www.ipdeny.com/ipblocks/data/countries/{ad,ae,af}.zone)
# ban everything - block country
sudo ipset add geo /var/geoiptest.txt

i think last row have fault, how can i resolve that ?

  • what do you mean by last row have default ? – Wissam Roujoulah Dec 24 '16 at 7:26
  • i resolve that it was mistake – Dani Dec 24 '16 at 7:31

Your iteration is wrong. the correct syntax would be something like:

sudo wget -O /var/geoiptest.txt http://www.ipdeny.com/ipblocks/data/countries/{ad,ae,af}.zone
while read ip; do
    sudo ipset add geo $ip
done < /var/geoiptest.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.