#!/bin/bash

usage="
        Usage: $(basename "$0") <MonId> [-h]
      Example: $(basename "$0") mon0
Functionality: It resolves the deviceId for the given MonId, for example, returning \"wlan0\" for \"mon0\".
			   It is the inverse function of DEV2MON.

      Options:
	-h		Show usage information
"

#if [[ $UID == 0 ]]; then
#	(>&2 echo "DO NOT run with sudo.")
#	echo "$usage"
#	exit 1
#fi

while getopts 'h' OPT; do
    case $OPT in
        h)
            echo "$usage"
			exit 1
    esac
done

if [[ $# == 0 ]]; then
	(>&2 echo "Argument deviceId is mandatory.")
	echo "$usage"
	exit 1
fi

ls /sys/class/net/$1/phy80211/device/net/ 2>/dev/null | grep -v mon


