You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
393 B

#!/bin/bash
# name of connected VPN
VPN_NAME=$(nmcli -t -f NAME,TYPE,STATE con | awk -F: '$2=="vpn" && $3=="activated" {print $1}')
# name of connected wifi
WIFI_NAME=$(nmcli -t -f NAME,TYPE,STATE con | awk -F: '$2!="vpn" && $3=="activated" {print $1}')
if [[ "${VPN_NAME}" == "" ]];
then
echo "${WIFI_NAME}"
elif [[ "${VPN_NAME}" =~ "PM" ]];
then
echo "PM"
else
echo "VPN"
fi