title: bash argument case for args in $@
body: <p>I have a script with a long list of OPTIONAL arguments. some have associated values.</p>
  
  <p>Such as:</p>
  
  <pre><code>.script --first 2012-12-25 --last 2012-12-26 --copy --remove
  .script --first 2012-12-25 
  </code></pre>
  
  <p>Thus the following case statement:</p>
  
  <pre><code>for arg in "$@"
  do
      case $arg in
          "--first" )
             START_DATE=$arg;;
          "--last" )
             END_DATE=$arg;;
          "--copy" )
             COPY=true;;
          "--remove" )
             REMOVE=true;;
  
  # ... and so on
     esac
  done
  </code></pre>
  
  <h3>My problem:</h3>
  
  <p>that needs a increment <code>$arg+1</code> type statement to get the following arg (in some cases).</p>
  
  <p>How is that possible?</p>
  
  <p>I'm also happy to do a substring such <code>.script --first2012-12-25 --last2012-12-26</code></p>
  
  <p>and not sure how to proceed there.</p>