#!/bin/bash
WRKPATH=/etc/network
DESTFILE=/etc/resolv.conf

/bin/sed --follow-symlinks -i "/\# $IFACE/d" $DESTFILE

readarray -t DNSSERVERS < <(/usr/bin/awk -f $WRKPATH/readInterfaces.awk $WRKPATH/interfaces device=$IFACE output=dns-nameservers)
for a in "${DNSSERVERS[@]}"; do
    if [[ ! -z $(/bin/grep "$a" "$DESTFILE") ]]; then
        /bin/sed --follow-symlinks -i "/$a/d" $DESTFILE
    fi
done    

