dotfiles/dot_local/bin/executable_mullvad-status

20 lines
394 B
Text
Raw Normal View History

2022-07-30 07:17:12 +02:00
#!/usr/bin/env bash
# if mullvad is not installed
if ! [ -x "$(command -v mullvad)" ]; then
echo " "
exit 1
fi
while read -r LINE; do
2022-07-30 07:17:12 +02:00
if echo "$LINE" | grep -q 'Connected'; then
# regex grep the relay, e.g. se7 for sweden-7
OUTPUT=$(echo "$LINE" | grep -oP "\w{2}\d+")
2022-07-30 07:17:12 +02:00
ICON=" "
else
ICON=" "
fi
echo "$ICON" "${OUTPUT^^}"
2022-07-30 07:17:12 +02:00
done < <(mullvad status listen)