#!/bin/bash nm_active=`nmcli con show --active` vpn_active='false' if [ -z ${1} ];then if echo "${nm_active}" | grep -q 'vpn' || echo "${nm_active}" | grep -q 'wireguard';then vpn_active='true' fi else if echo "${nm_active}" | grep -q "${1}";then vpn_active='true' fi fi printf '%s' "${vpn_active}"