title: syntax error near unexpected token `if'
body: <p>I am currently trying to write a bash script which helps me step through a directory and check for .jpeg or .jpg extensions on files. I've come up with the following:</p>
  
  <pre><code>#declare $PICPATH, etc...
  
  for file in $PICPATH
      if [ ${file -5} == ".jpeg" -o ${file -4} == ".jpg" ];
      then
          #do some exif related stuff here.
      else
          #throw some errors
      fi
  done
  </code></pre>
  
  <p>Upon execution, bash keeps throwing a an error on the if line: "syntax error near unexpected token `if'.</p>
  
  <p>I'm a completely new to scripting; what is wrong with my if statement?</p>
  
  <p>Thanks. </p>