Checking COUNTER variables if their value are zero, chnaging to one.

This commit is contained in:
2022-02-15 16:14:21 +00:00
parent cf6b73500e
commit 746216b251

View File

@@ -84,21 +84,25 @@ COUNT_SOURCE_PORT=$(set |grep SOURCE_PORT |wc -l)
COUNT_TARGET_IP=$(set |grep TARGET_IP |wc -l) COUNT_TARGET_IP=$(set |grep TARGET_IP |wc -l)
COUNT_TARGET_PORT=$(set |grep TARGET_PORT |wc -l) COUNT_TARGET_PORT=$(set |grep TARGET_PORT |wc -l)
if [ "$COUNT_SOURCE_IP" == 0 ] ; then COUNT_SOURCE_IP=1 ; fi
for source_ip_index in $(seq 1 $COUNT_SOURCE_IP) ; do for source_ip_index in $(seq 1 $COUNT_SOURCE_IP) ; do
if set |grep SOURCE_IP_ ; then if set |grep SOURCE_IP_ ; then
SOURCE_IP=$(eval "echo \${"SOURCE_IP_$source_ip_index"}") SOURCE_IP=$(eval "echo \${"SOURCE_IP_$source_ip_index"}")
fi fi
if [ "$COUNT_SOURCE_PORT" == 0 ] ; then COUNT_SOURCE_PORT=1 ; fi
for source_port_index in $(seq 1 $COUNT_SOURCE_PORT) ; do for source_port_index in $(seq 1 $COUNT_SOURCE_PORT) ; do
if set |grep SOURCE_PORT_ ; then if set |grep SOURCE_PORT_ ; then
SOURCE_PORT=$(eval "echo \${"SOURCE_PORT_$source_port_index"}") SOURCE_PORT=$(eval "echo \${"SOURCE_PORT_$source_port_index"}")
fi fi
if [ "$COUNT_TARGET_IP" == 0 ] ; then COUNT_TARGET_IP=1 ; fi
for target_ip_index in $(seq 1 $COUNT_TARGET_IP) ; do for target_ip_index in $(seq 1 $COUNT_TARGET_IP) ; do
if set |grep TARGET_IP_ ; then if set |grep TARGET_IP_ ; then
TARGET_IP=$(eval "echo \${"TARGET_IP_$target_ip_index"}") TARGET_IP=$(eval "echo \${"TARGET_IP_$target_ip_index"}")
fi fi
if [ "$COUNT_TARGET_PORT" == 0 ] ; then COUNT_TARGET_PORT=1 ; fi
for target_port_index in $(seq 1 $COUNT_TARGET_PORT) ; do for target_port_index in $(seq 1 $COUNT_TARGET_PORT) ; do
if set |grep TARGET_PORT_ ; then if set |grep TARGET_PORT_ ; then
TARGET_PORT=$(eval "echo \${"TARGET_PORT_$target_port_index"}") TARGET_PORT=$(eval "echo \${"TARGET_PORT_$target_port_index"}")