diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2024-02-23 18:17:29 -0800 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2024-02-23 18:17:29 -0800 |
commit | 31ad5863d1279f591e38d3239e35af58509a9dc4 (patch) | |
tree | b55b1beae0f62eac53d9389e26794277ffb4b684 /sh/snippets | |
parent | c6389ce90923f486d0a8458827cebc53f358c846 (diff) |
update
Diffstat (limited to 'sh/snippets')
-rw-r--r-- | sh/snippets | 22 |
1 files changed, 14 insertions, 8 deletions
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 |