Just started use getopts and found one problem...For example - have a script with:while getopts h:loav opt; docase $opt inh)  h=$OPTARG  echo $h  ;;But whet I run it:$ ./ftpclean.sh -h -l-lI got second option as argument for first option... So - if user forgot set argument:$ ./ftpclean.sh -h argumentargumentgetopts will set echo *second option*...Is there any legal way to avoid it?Best solution wich I found - is to add function:function checkargs () {if [[ $OPTARG =~ ^-[a/l/o/a/v]$ ]]  then  echo OPTERR  exit 1fi}And run it before set variable: while getopts h:loav opt; do  case $opt inh)  checkargs  h=$OPTARG  echo $h  ;;So now:$ ./ftpclean.sh -h -lOPTERR
getopts - how to avoid read next $OPTARG as argument?
bash;function;getopts