#!/bin/bash if $(nmcli -g GENERAL.STATE c s Home|grep -q '\bactiv'); then echo "going down" nmcli connection down Home else echo "going up" nmcli connection up Home fi