#!/bin/bash

usage="
        Usage: $(basename "$0") <AnyId> [-h]
      Example: $(basename "$0") phy0
Functionality: It removes the Wi-Fi monitor interface for the given device <AnyId>.

      Options:
	-h		Show usage information
"

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

inputArray=""

if [[ $# == 1 ]]; then
	inputArray=$1
fi

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

scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
${scriptDir}/array_eval "$inputArray" "sudo iw MON del 1>/dev/null 2>/dev/null"