Error checking command line flags, also using $* instead of $@ as recommended in the getopt man page