title: not allow multiple option in getopts of bash script
body: <p>Having bash script as follows </p>
  
  <pre><code>#! /bin/bash
  
  usage()
  {
    echo -e "need help!"  
  }
  
  while getopts ":a:b:h" OPTION
  do
       case $OPTION in
       a)
          printf "a option with value %s\n" $OPTARG
          ;;
       b)
          printf "b option with value %s\n" $OPTARG
          ;;
       h)
          usage
          ;;
       ?)
          echo -e "No option selected"
         ;;
      esac
  done
  
  exit 0
  </code></pre>
  
  <p>Above script run fine with different option but i wanted to extend it to not allow to pass multiple option at same time like as following argument </p>
  
  <pre><code>$ ./test.bash -a 1 -b 2
  a option with value 1
  b option with value 2
  </code></pre>
  
  <p>should be not valid means some way it give me error like <code>wrong syntax</code> i achieved it by as follows but it seems to long it is as follow</p>
  
  <pre><code>#! /bin/bash
  usage()
  {
    echo -e "need help!"  
  }
  
  let "a_count=0"
  let "b_count=0"
  MY_ARG=""
  while getopts ":a:b:h" OPTION
  do
       case $OPTION in
       a)
          let a_count=1
          MY_ARG=$OPTARG
          ;;
       b)
          let b_count=1
          MY_ARG=$OPTARG
          ;;
       h)
          usage
          ;;
       ?)
          echo -e "No option selected"
         ;;
      esac
  done
  
  [[ $a_count -eq 1 ]] &amp;&amp; [[ $b_count -eq 1 ]] &amp;&amp; echo "wrong command sytax" &amp;&amp; exit 0
  
  [[ $a_count -eq 1 ]] &amp;&amp;  printf "a option with value %s\n" $MY_ARG
  
  [[ $b_count -eq 1 ]] &amp;&amp;  printf "b option with value %s\n" $MY_ARG
  
  exit 0
  </code></pre>
  
  <p>run like</p>
  
  <pre><code>$ ./test.bash -a 1 -b 2
  wrong command sytax
  </code></pre>
  
  <p>But i want to finish validation in <code>while..loop</code> of <code>getopts</code>. Also this validation not works for following command</p>
  
  <pre><code>./test.bash -a -b 
  a option with value -b
  </code></pre>
  
  <p>any one have batter idea how to use <code>getopts</code> for this type validation?</p>