#!/bin/bash

usage="
        Usage: $(basename "$0") <deviceId> [-h]
      Example: $(basename "$0") wlan0
Functionality: It lists all Wi-Fi monitor interfaces which are attached to deviceId.
               It is the inverse function of MON2DEV.

      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 required.")
	echo "$usage"
	exit 1
fi

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


