#!/bin/sh
where_is="/etc/NetworkManager/system-connections/"
n_dns="dns=1.1.1.1;1.0.0.1;"
cd $where_is
wn=$(iwgetid -r)

case "$wn" in
      '')
        echo "No active WI-FI connection found"
        exit
   ;;
      *)
        wf=$(echo $wn.nmconnection)

      ;;
esac


c_dns=$(cat $where_is"$wf" | grep -v grep | grep dns=)
full_name=$where_is/"$wf"
sed -i "s/${c_dns}/${n_dns}/g" "$full_name"


