title: getopts when first option is a path in bash
body: <p>I'm having an issue with getopts in a bash script. Basically my script would have to be called with something like:</p>
  
  <p>./myScript /path/to/a/folder -a -b</p>
  
  <p>What I have at the top of my code is this:</p>
  
  <pre><code>while getopts ":ab" opt; do
   case $opt in
    a) 
     variable=a
     ;;
    b)    
     variable=b
     ;;
    \?)
     echo "invalid option -$OPTARG"
     exit 0
   esac
  done
  
  echo "$variable was chosen"
  </code></pre>
  
  <p>Now, this works as long as I call my script without  /path/to/a/folder…  How can I make it to work with it instead?</p>
  
  <p>Thanks a lot</p>