use getopts to repleace getopt, to handle invalid parameter