···44uname=$(whoami)
55admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)
6677-# Choice for DNS or IP
88-PS3='Choose your preferred option, IP or DNS/Domain:'
99-WAN=("IP" "DNS/Domain")
1010-select WANOPT in "${WAN[@]}"; do
1111-case $WANOPT in
1212-"IP")
1313-wanip=$(dig @resolver4.opendns.com myip.opendns.com +short)
1414-break
1515-;;
1616-1717-"DNS/Domain")
1818-echo -ne "Enter your preferred domain/dns address ${NC}: "
1919-read wanip
2020-#check wanip is valid domain
2121-if ! [[ $wanip =~ ^[a-zA-Z0-9]+([a-zA-Z0-9.-]*[a-zA-Z0-9]+)?$ ]]; then
2222- echo -e "${RED}Invalid domain/dns address${NC}"
2323- exit 1
2424-fi
2525-break
2626-;;
2727-*) echo "invalid option $REPLY";;
2828-esac
2929-done
3030-317# identify OS
328if [ -f /etc/os-release ]; then
339 # freedesktop.org and systemd
···10177 # if they say no, exit the script
10278 exit 1
10379fi
8080+8181+# Choice for DNS or IP
8282+PS3='Choose your preferred option, IP or DNS/Domain:'
8383+WAN=("IP" "DNS/Domain")
8484+select WANOPT in "${WAN[@]}"; do
8585+case $WANOPT in
8686+"IP")
8787+wanip=$(dig @resolver4.opendns.com myip.opendns.com +short)
8888+break
8989+;;
9090+9191+"DNS/Domain")
9292+echo -ne "Enter your preferred domain/dns address ${NC}: "
9393+read wanip
9494+#check wanip is valid domain
9595+if ! [[ $wanip =~ ^[a-zA-Z0-9]+([a-zA-Z0-9.-]*[a-zA-Z0-9]+)?$ ]]; then
9696+ echo -e "${RED}Invalid domain/dns address${NC}"
9797+ exit 1
9898+fi
9999+break
100100+;;
101101+*) echo "invalid option $REPLY";;
102102+esac
103103+done
104104+105105+104106105107# #/*
106108# Alternatively since case is faster than if then else