From 49d3644d6acfe3be2da618c64b6704a8fae6be73 Mon Sep 17 00:00:00 2001 From: huzibaca Date: Tue, 19 Nov 2024 13:28:17 +0800 Subject: [PATCH] chore: format --- scripts/set_dns.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/set_dns.sh b/scripts/set_dns.sh index 8440b228..e730a47a 100644 --- a/scripts/set_dns.sh +++ b/scripts/set_dns.sh @@ -21,8 +21,8 @@ function is_valid_ipv4() { # 验证IPv6地址格式 function is_valid_ipv6() { local ip=$1 - if [[ ! $ip =~ ^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$ ]] && \ - [[ ! $ip =~ ^(([0-9a-fA-F]{0,4}:){0,7}:|(:[0-9a-fA-F]{0,4}:){0,6}:[0-9a-fA-F]{0,4})$ ]]; then + if [[ ! $ip =~ ^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$ ]] && + [[ ! $ip =~ ^(([0-9a-fA-F]{0,4}:){0,7}:|(:[0-9a-fA-F]{0,4}:){0,6}:[0-9a-fA-F]{0,4})$ ]]; then return 1 fi return 0 @@ -59,8 +59,8 @@ done # 更新DNS设置 if [ "$is_valid_dns" = false ]; then - echo "empty" > original_dns.txt + echo "empty" >original_dns.txt else - echo "$original_dns" > original_dns.txt + echo "$original_dns" >original_dns.txt fi -networksetup -setdnsservers "$hardware_port" "$1" \ No newline at end of file +networksetup -setdnsservers "$hardware_port" "$1"