title: Why does the shell complain about this script in a Makefile?
body: <p>Why does this fragment of shell script give an error in a Makefile?</p>
  
  <pre><code>-@for file in `cat export_mojave_tcl_files.list`; do \
  if { [ -f $(TEST_PATH)/$$file ] &amp;&amp; [-f $$file]} ; \
  then diff $$file bk_marker &gt; $$file.diff ; \
  if {! [ -s $$file.diff ]}; \
  then rm -f $$file.diff ; \
  else echo $$file &gt;&gt; marker.fill.tcl.diff; \
  fi \
  elif {[ -f $(TEST_PATH)/$$file] &amp;&amp; ! [ -f $$file]} ; \
  then echo $$file &gt;&gt; gold_exists; \
  else echo $$file &gt;&gt; test_exists; \
  fi; \
  done ;
  </code></pre>
  
  <h3>Error</h3>
  
  <pre><code>/bin/sh: -c: line 1: syntax error near unexpected token `then'
  /bin/sh: -c: line 1: `for file in `cat export_mojave_tcl_files.list`; do  if { [ -f ../GOLD/$file ] &amp;&amp; [-f $file] } ;  then diff $file bk_marker &gt; $file.diff ;  if ! [ -s $file.diff ]};  then rm -f $file.diff ;  else echo $file &gt;&gt; marker.fill.tcl.diff;  fi  elif { [ -f ../GOLD/$file] &amp;&amp; ! [ -f $file] } ;  then echo $file &gt;&gt; gold_exists;  else echo $file &gt;&gt; test_exists;  fi;  done ;'
  </code></pre>