title: Bash multiple combinations in getopts
body: <p>I would like to make a script where you can give a couple of parameters with it:</p>
  
  <pre><code>while getopts ":a:b:c:" opt; do
    case $opt in
      a)
        echo "-a was triggered
        ;;
      b)
        echo "-b was triggered
        ;;
      \?)
        echo "Invalid option: -$OPTARG" &gt;&amp;2
        exit 1
        ;;
      :)
        echo "Option -$OPTARG requires an argument." &gt;&amp;2
        exit 1
        ;;
    esac
  done
  </code></pre>
  
  <p>The code I have now works but the problem I have is that I want to give another function/echo if it combines.</p>
  
  <p>Example:
    When I do: .MyScript -ab than it should give another function that what is defined in "a" or in "b"</p>
  
  <p>so a bit like:</p>
  
  <pre><code>ab) -&gt; Script -a -b or Script -ab 
   echo "-ab was triggered"
  </code></pre>
  
  <p>What is the best solution to do this?
  Any ideas, your free to post!</p>