title: How do I use a variable argument number in a bash script?
body: <pre><code>#!/bin/bash
  # Script to output the total size of requested filetype recursively
  
  # Error out if no file types were provided
  if [ $# -lt 1 ]
  then 
    echo "Syntax Error, Please provide at least one type, ex: sizeofTypes {filetype1} {filetype2}"
    exit 0
  fi
  
  #set first filetype
  types="-name *."$1
  
  #loop through additional filetypes and append
  num=1
  while [ $num -lt $# ]
  do
    (( num++ ))
    types=$types' -o -name *.'$$num
  done
  
  echo "TYPES="$types
  
  find . -name '*.'$1 | xargs du -ch *.$1 | grep total
  </code></pre>
  
  <p>The problem I'm having is right here:</p>
  
  <pre><code> #loop through additional filetypes and append
      num=1
      while [ $num -lt $# ]
      do
        (( num++ ))
        types=$types' -o -name *.'&gt;&gt;$$num&lt;&lt;
      done
  </code></pre>
  
  <p>I simply want to iterate over all the arguments not including the first one, should be easy enough, but I'm having a difficult time figuring out how to make this work</p>