19 lines
394 B
Bash
19 lines
394 B
Bash
#!/usr/bin/env bash
|
|
|
|
# if mullvad is not installed
|
|
if ! [ -x "$(command -v mullvad)" ]; then
|
|
echo " "
|
|
exit 1
|
|
fi
|
|
|
|
while read -r LINE; do
|
|
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+")
|
|
ICON=" "
|
|
else
|
|
ICON=" "
|
|
fi
|
|
|
|
echo "$ICON" "${OUTPUT^^}"
|
|
done < <(mullvad status listen)
|