From help getopts
(in bash
):
getopts: getopts optstring name [arg] Parse option arguments. Getopts is used by shell procedures to parse positional parameters as options. OPTSTRING contains the option letters to be recognized; if a letter is followed by a colon, the option is expected to have an argument, which should be separated from it by white space.
I think it's valid also for sh
. You should try ":a:f:l:r:hv"
instead of ":a:f:l:r:h:v:"
.