#!/bin/bash

usage="
        Usage: $(basename "$0") <MonId> [-h]
      Example: $(basename "$0") mon0
Functionality: It resolves the phyId for the given MonId. For example, it may return \"phy0\" for \"mon0\".
			   It is the inverse function of PHY2MON.

      Options:
	-h		Show usage information
"

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

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

cat /sys/class/net/$1/phy80211/name 2>/dev/null


