Possible Duplicate:
Using getopts in bash shell script to get long and short command line options
This is the code i've written
#! /bin/bash
getopts master $1
while getopts ":master" opt; do
case $opt in
master)
echo "-master was triggered! $1 was entered" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
and this is the output i'm getting-
]$ ./test123.sh -master 123
./test123.sh: line 3: getopts: `-master': not a valid identifier
How do i define a user defined option?