I have a section of code in a bash shell script that looks like this, with a series of consecutive conditionals:
#do January first, no matter what
awk '$4 == "Jan" {print $0}' < last-output.txt | sort -u -k1 > 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 > t1.txt
(IFS="|"; grep -vE "(${name_to_exclude[*]})" t1.txt > 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}' < last-output.txt | sort -u -k1 > 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 > t2.txt
(IFS="|"; grep -vE "(${name_to_exclude[*]})" t2.txt > t2_new.txt)
fi
if [ ${this_month} -ge 3]
awk '$4 == "Mar" {print $0}' < last-output.txt | sort -u -k1 > 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 > t3.txt
(IFS="|"; grep -vE "(${name_to_exclude[*]})" t3.txt > t3_new.txt)
fi
continuing through all the months all the way to December.
When I try to run the script I get this error message:
./login-act.sh: line 37: syntax error near unexpected token `fi'
./login-act.sh: line 37: `fi'
(line 37 is the first occurrence of "fi")
How do I make this error go away?