getopt help

I m trying to use getopt
This is my script, but it doesn't take argument in variable,
Please help.

set - - `getopt mscl: $*`

if [ $? != 0 ]
then
	echo "Exiting...."
	exit 2
fi

for i in $*
do
	case $i in
	-m)     MAIL="$i"; shift;;
	-s)	SCRIPT=$OPTARG; shift;;
	-c)	COB=$OPTARG; shift;;
	-l)	LOC=$OPTARG; shift;;
	#--)	echo "\nUsage: [-m MAIL] [-b BRANCH ] [-p PURPOSE] [-s SCRIPT] [-c COBdate] [-l LOCATION] [-h help]\n";SHIFT;;
	esac
done

You've misunderstood how getopt works. the ':' is appended to the switch letter that takes an argument

while getopt a:v o
do	case "$o" in
	a)	VAR=$OPTARG;;
	b)	VERBOSE=true;;
	[?])	echo "Usage: $0 -a <something> [-v]"
		exit 1;;
	esac
done

here 'a' requires an arg and 'v' does not. This is represented by 'a:' and 'v'. So, if you want to add 'm' which requires a parameter you'd add 'm' followed by ':' . your getopt statement would be 'getopt a:m:v'

Hi there,

Can anyone please explain how to use getopt?