#!/bin/bash type="${1}" action="${2}" devices=$(nmcli -g DEVICE device) for d in ${devices};do if [ "$(nmcli -g GENERAL.TYPE device show ${d})" = "${type}" ];then printf 'device: %s\n' "${d}" fi done