title: Bash shell script: "syntax error near unexpected token `fi'"
body: <p>I have a section of code in a bash shell script that looks like this, with a series of consecutive conditionals:</p>
  
  <pre><code>#do January first, no matter what
  awk '$4 == "Jan" {print $0}' &lt; last-output.txt | sort -u -k1 &gt; Jan.txt
  awk -F'[ +:()]+' 'FNR==NR{a[$1]; next;} !($1 in a){next} NF==13{b[$1]+=$12/60+$11} NF==14{b[$1]+=$13/60+$12+24*$11} END{print "[Jan]"; for (n in b)print n,b[n],"hours"; print "\n"}' namelist Jan.txt &gt; t1.txt
  (IFS="|"; grep -vE "(${name_to_exclude[*]})" t1.txt &gt; t1_new.txt)
  
  #now iterate month by month for the rest of the months, up to the current month
  if [ ${this_month} -ge 2]
          awk '$4 == "Feb" {print $0}' &lt; last-output.txt | sort -u -k1 &gt; Feb.txt
          awk -F'[ +:()]+' 'FNR==NR{a[$1]; next;} !($1 in a){next} NF==13{b[$1]+=$12/60+$11} NF==14{b[$1]+=$13/60+$12+24*$11} END{print "[Feb]"; for (n in b)print n,b[n],"hours"; print "\n"}' namelist Feb.txt &gt; t2.txt
          (IFS="|"; grep -vE "(${name_to_exclude[*]})" t2.txt &gt; t2_new.txt)
  fi
  if [ ${this_month} -ge 3]
          awk '$4 == "Mar" {print $0}' &lt; last-output.txt | sort -u -k1 &gt; Mar.txt
          awk -F'[ +:()]+' 'FNR==NR{a[$1]; next;} !($1 in a){next} NF==13{b[$1]+=$12/60+$11} NF==14{b[$1]+=$13/60+$12+24*$11} END{print "[Mar]"; for (n in b)print n,b[n],"hours"; print "\n"}' namelist Mar.txt &gt; t3.txt
          (IFS="|"; grep -vE "(${name_to_exclude[*]})" t3.txt &gt; t3_new.txt)
  fi
  </code></pre>
  
  <p>continuing through all the months all the way to December.</p>
  
  <p>When I try to run the script I get this error message:</p>
  
  <pre><code>./login-act.sh: line 37: syntax error near unexpected token `fi'
  ./login-act.sh: line 37: `fi'
  </code></pre>
  
  <p>(line 37 is the first occurrence of "fi")</p>
  
  <p>How do I make this error go away?</p>