In fact, I deliberately do not write the deletion of the section, because the management of the server will only add port will not shut down.
=====================
#! Bin/bash
While:
Do
Clear
echo "Detect Open Ports:"
Echo-e "\033[33m ' cat/etc/sysconfig/iptables | grep "Dport" | Cut-d '-F-\033[0m '
echo "---------------------"
echo "Plase enter new port (Ctrl + C to Exit):"
Read InPort
#echo "---------------------"
#echo "Enter to Finish,ctrl+c to Exit."
ilink= ' Grep-n "Dport"/etc/sysconfig/iptables | Tail-1 | Cut-d ': '-F 1 '
#echo $ilink
# ((ilink++))
t1= "-A input-m State--state new-m tcp-p TCP--dport"
t2= "-j ACCEPT"
Sed-i "${ilink}a ${t1} ${inport} ${t2}"/etc/sysconfig/iptables
Done
===================================
PostScript: An empty collation should be able to be more reasonable, but the current understanding is so much.
Initial shell, set port parameters