From 31ad5863d1279f591e38d3239e35af58509a9dc4 Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Fri, 23 Feb 2024 18:17:29 -0800 Subject: update --- sh/snippets | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'sh') diff --git a/sh/snippets b/sh/snippets index 6f336c1..f82ab7e 100644 --- a/sh/snippets +++ b/sh/snippets @@ -54,14 +54,20 @@ EOF cd "$HOME/.bitmonero" || exit monero-blockchain-export --output-file "$XDG_DOWNLOAD_DIR/xmr/monero_blockchain.raw" -nm_device_state="$(nmcli -t --fields device,state device)" -if echo "$nm_device_state" | grep -q '^wg_ka:connected$'; then - echo ka -elif echo "$nm_device_state" | grep -q '^wg_studio:connected$'; then - echo studio -else - echo insp -fi +# the old way, slower and more code +#nm_device_state="$(nmcli -t --fields device,state device)" +#if echo "$nm_device_state" | grep -q '^wg_ka:connected$'; then +# echo ka +#elif echo "$nm_device_state" | grep -q '^wg_studio:connected$'; then +# echo studio +#else +# echo insp +#fi +case "$(nmcli -t --fields device,state device)" in + *wg_ka:connected*) echo ka;; + *wg_studio:connected*) echo studio;; + *) echo insp;; +esac printf 'default: '; curl -m1 ifconfig.co printf '4: '; curl -4m1 ifconfig.co printf '6: '; curl -6m1 ifconfig.co -- cgit 1.4.1