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