Should getopts work correctly in functions? I find if I try that if I
get an error processing the options, then retry the function, it seems
to get confused.

Do I have to do something explicit to reset getopts?

My code looks like (... elides detail):

function jc()
{
  while getopts "d:c:h" OPT; do
    case $OPT in
      d )  ... ;;
      c )  ... ;;
      h )  echo $USAGE 
           return 1 ;;
      \? ) echo "Error, unrecognized option"
           echo $USAGE 
           return 1 ;;
    esac
  done

  ...
}

-- 
Best regards,
 Andy              mailto:[EMAIL PROTECTED]



--
Want to unsubscribe from this list?
Send a message to [EMAIL PROTECTED]

Reply via email to