title: Why this 'syntax error' before 'else'?
body: <p>I'm writing a shell script to unzip files in a directory. There are files with same name in different zip files; the code must keep the bigger one.</p>
  
  <p>I need to unzip files in /test directory. There are thousands of zip files and I don't have room to unzip them at the same time. So I create a folder /test/tmp and unzip one zip file into the folder. Then compare the file in the /test and /test/tmp folders. If there are duplicate file, compare their size and keep the file with bigger size in the /test. If there isn't duplicate, move the file from /test/tmp to /tmp.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#!/bin/bash
  A="/test"
  B="/test/tmp"
  archives=$(ls $A *.zip 2&gt;/dev/null)
  for archive in "${archives}"  
  do
      mkdir -p "${B}" &amp;&amp; unzip "${archive}" -d $B
      for file_tmp in 'ls $B *.log 2&gt;/dev/null'
      do
          file_root="${A}${file_tmp}"
          if [-f "${file_root}"] then
              if [[$(stat -c %s "${file_tmp}") -ge $(stat -c %s "${file_root}")]]
              then mv "${file_tmp}" "${file_root}"
              else rm "${file_tmp}"
              fi 
          else mv "${file_tmp}" $A
          fi
      done
  done
  </code></pre>
  
  <p>But I keep getting the error</p>
  
  <pre><code>unziptest.sh: line 16: syntax error near unexpected token `else'
  unziptest.sh: line 16: `            else mv "${file_tmp}" $A'
  </code></pre>
  
  <p>What is wrong?</p>