Need some help with my custom bash code

Discussion in 'Programming' started by chrisj383, Feb 22, 2016.

  1. #1
    Hey,

    The code below checks with the file called ips.info and lists the IPs for a reversedns DNS entry.
    It works if all the IPs are from the same subnet but if the Main IP is from a different subnet it just misses out the Main IP.

    Quant=0
    for Ip in $Ips
    do
      echo "$Reverso$Quant   IN   A   $Ip" >> $ArqNamed 
      Quant=`expr $Quant + 1`
    done
    echo " " >> $ArqNamed
    
    if [ $IpsQuant -gt 8 ]
    then
    sed -i "/$Reverso\0/d" $ArqNamed
    fi
    Code (markup):
    For some reason it's missing out the Main IP from that file for example if your IPs were like this:

    67.21.233.89
    173.214.162.168
    173.214.162.169
    173.214.162.170
    173.214.162.171
    173.214.162.172

    The code above misses out this IP 67.21.233.89

    How can i fix this.

    Thanks In Advance,
    Chris
     
    chrisj383, Feb 22, 2016 IP