#!/bin/bashfor ip in `cat ipp.txt`doif [[ $ip =~ \"192\" ]] || [[ $ip =~ \"127\" ]]; thenecho \"$ip is ok\"elseecho \"$ip is not ok\"iptables -I INPUT -ptcp -s $ip -j DROPfidone
执行之后的效果
#!/bin/bashfor ip in `cat ipp.txt`doif [[ $ip =~ \"192\" ]] || [[ $ip =~ \"127\" ]]; thenecho \"$ip is ok\"elseecho \"$ip is not ok\"iptables -I INPUT -ptcp -s $ip -j DROPfidone
执行之后的效果