I'm trying to create a loop or I believe in this case nested for loops but the logic escapes me.
Can someone please assist here? My logic looks way off here ..
for ip in $(cat $ZONES_PATH/br.zone ); do ipset -A brazil $ip; done
for ip in $(cat $ZONES_PATH/cn.zone ); do ipset -A china $ip; done
for ip in $(cat $ZONES_PATH/eg.zone ); do ipset -A egypt $ip; done
for ip in $(cat $ZONES_PATH/in.zone ); do ipset -A india $ip; done
---------------------------
countries.txt file will contain - brazil china egypt india)
initial=(br cn eg in)
for (( i=0; i < ${#initial[@]}; ++i )); do
for ip in $(cat $ZONES_PATH/$initial.zone); do
for x in $(cat ~/countries.txt); do
ipset -A $x $ip
done
done
Can someone please assist here? My logic looks way off here ..
for ip in $(cat $ZONES_PATH/br.zone ); do ipset -A brazil $ip; done
for ip in $(cat $ZONES_PATH/cn.zone ); do ipset -A china $ip; done
for ip in $(cat $ZONES_PATH/eg.zone ); do ipset -A egypt $ip; done
for ip in $(cat $ZONES_PATH/in.zone ); do ipset -A india $ip; done
---------------------------
countries.txt file will contain - brazil china egypt india)
initial=(br cn eg in)
for (( i=0; i < ${#initial[@]}; ++i )); do
for ip in $(cat $ZONES_PATH/$initial.zone); do
for x in $(cat ~/countries.txt); do
ipset -A $x $ip
done
done