From bcb9372262dc1dce5ab331b690ab7c4a27bab838 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Tue, 15 Sep 2015 19:58:46 +0100 Subject: [PATCH] Change flush-dns script to be a bit neater. --- bin/flush-dns | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/bin/flush-dns b/bin/flush-dns index 56cdd58..5001514 100755 --- a/bin/flush-dns +++ b/bin/flush-dns @@ -1,5 +1,7 @@ #!/usr/bin/env bash +shopt -s extglob + OS=$(uname -s) REL=$(uname -r) @@ -13,19 +15,14 @@ function sorry() case ${OS} in Darwin) PROD_VER=$(sw_vers -productVersion) case ${PROD_VER} in - 10.10.3|\ - 10.10.2|\ - 10.10.1|\ - 10.10.0|\ - 10.10) sudo discoveryutil mdnsflushcache - ;; + 10.10?(.[0-3])) sudo discoveryutil mdnsflushcache + ;; - 10.6.*|\ - 10.6) sudo dscacheutil -flushcache - ;; + 10.6?(.*)) sudo dscacheutil -flushcache + ;; - *) sudo killall -HUP mDNSResponder - ;; + *) sudo killall -HUP mDNSResponder + ;; esac ;;