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

readarray -t DNSSERVERS < <(/usr/bin/awk -f $WRKPATH/readInterfaces.awk $WRKPATH/interfaces device=$IFACE output=dns-nameservers)

for DNS in "${DNSSERVERS[@]}"; do
    if [[ -z $(/bin/grep "$DNS" "$DESTFILE") ]]; then
#        /bin/sed --follow-symlinks -i "1 s/^/$a\n/" $DESTFILE
        echo "$DNS # $IFACE" >> $DESTFILE
    fi         
done    

