title: option requires an argument error
body: <p>I wrote a shell script to do something. Everything works fine! A part of my code is something like this, so that I can pass options and arguments to it:</p>
  
  <pre><code>while getopts "a:b:c" opt
  do
   case $opt in
    a) AA=$OPTARG ;;
    b) BB=$OPTARG ;;
    c) CC=$OPTARG ;;
   esac
  done
  shift $(expr $OPTIND - 1)
  </code></pre>
  
  <p>But now I want to add an option, say <code>d</code> and I don't want it to use any argument, as the code shows below, but it ends with an error, complaining <code>option requires an argument error -- d</code> It seems that getopts can't do that.</p>
  
  <pre><code>while getopts "a:b:c:d" opt
  do
   case $opt in
    a) AA=$OPTARG ;;
    b) BB=$OPTARG ;;
    c) CC=$OPTARG ;;
    d) DD="ON" ;;
   esac
  done
  shift $(expr $OPTIND - 1)
  </code></pre>
  
  <p>What should I do then? What is the common practice if I want both option types, one can accept argument, while the other doesn't need argument?</p>