#!/bin/bash if [ -f /etc/netplan/eth0.yaml ]; then cat /etc/netplan/eth0.yaml else cat /etc/network/interfaces fi echo read -n 1 -p "Do you wish to continue changing the DNS? (Y/n) " choice case "$choice" in [Nn]) exit 0; ;; * ) if [ -f /etc/netplan/eth0.yaml ]; then sed -i 's/10.5.10.5,10.10.10.10/10.20.20.20,10.10.10.10,10.10.10.11/g' /etc/netplan/eth0.yaml sed -i 's/10.10.10.10,10.5.10.5/10.20.20.20,10.10.10.10,10.10.10.11/g' /etc/netplan/eth0.yaml sed -i 's/10.10.10.2,10.10.10.3/10.20.20.20,10.10.10.10,10.10.10.11/g' /etc/netplan/eth0.yaml sed -i 's/10.10.10.10,10.10.10.11/10.20.20.20,10.10.10.10,10.10.10.11/g' /etc/netplan/eth0.yaml /usr/sbin/netplan apply else sed -i 's/10.10.10.10 10.5.10.5/10.20.20.20 10.10.10.10 10.10.10.11/g' /etc/network/interfaces sed -i 's/10.5.10.5 10.10.10.10/10.20.20.20 10.10.10.10 10.10.10.11/g' /etc/network/interfaces sed -i 's/10.10.10.2 10.10.10.3/10.20.20.20 10.10.10.10 10.10.10.11/g' /etc/network/interfaces sed -i 's/10.10.10.10 10.10.10.11/10.20.20.20 10.10.10.10 10.10.10.11/g' /etc/network/interfaces /usr/sbin/service networking restart fi;; esac echo if [ -f /etc/netplan/eth0.yaml ]; then cat /etc/netplan/eth0.yaml else cat /etc/network/interfaces fi echo