title: Bash script: syntax error: unexpected end of file
body: <p>I have the following file and I have chmod a+x on the file.
  When I try to run it, I get a line 75: syntax error: unexpected end of file. What is the error with my script? What do I need to do to fix it?</p>
  
  <pre><code>#!/bin/sh
  # log directory for ascp transfer
  logdirectory=/tmp/log20079
  # log for this script
  baselog=$logdirectory/sent4files.log
  #directory of where the files to be transferred are located
  basedirectory=/tmp/test20079/
  
  #remote host data
  REMOTE_DIR=/Upload
  REMOTE_HOST=xxx
  REMOTE_USER=xxx
  # extensions of file
  FEATURE_EXT=feature
  KEYART_EXT=keyart
  TRAILER_EXT=trailer
  METADATA_EXT=metadata
  
  # files to be excluded, must match exclude_file_suffix
  COMPLETE_EXT=complete
  SENT_EXT=sent
  
  # file to send on completion
  FILE_ON_COMPLETE="$basedirectory"delivery.complete
  
  if [ "$TYPE" == "File" ]; then
     if [ "$STARTSTOP" == "Stop" ]; then
       if [ "$STATE" == "success" ]; then
          filename=$(basename "$FILE")
          extension="${filename##*.}"
  
  # check the extension here, and create files ending in .sent as a flag
  
          case "$extension" in
  
          "$FEATURE_EXT")
             cat &gt; "$basedirectory$FEATURE_EXT.$SENT_EXT" &lt;&lt; 'EOF'
             EOF
             echo "Feature sent" &gt;&gt; $baselog
              ;;
          "$KEYART_EXT")
             cat &gt; "$basedirectory$KEYART_EXT.$SENT_EXT" &lt;&lt; 'EOF'
             EOF
             echo "Keyart sent" &gt;&gt; $baselog
              ;;
          "$TRAILER_EXT")
             cat &gt; "$basedirectory$TRAILER_EXT.$SENT_EXT" &lt;&lt; 'EOF'
             EOF
             echo "Trailer sent" &gt;&gt; $baselog
              ;;
          "$METADATA_EXT")
             cat &gt; "$basedirectory$METADATA_EXT.$SENT_EXT" &lt;&lt; 'EOF'
             EOF
             echo "Metadata sent" &gt;&gt; $baselog
             ;;
          esac
  
  
  # check that all four files exists
          if [ -e "$basedirectory$FEATURE_EXT.$SENT_EXT" ] &amp;&amp; [ -e "$basedirectory$KEYART_EXT.$SENT_EXT" ] &amp;&amp; [ -e "$basedirectory$TRAILER_EXT.$SENT_EXT" ] &amp;&amp; [ -e "$basedirectory$METADATA_EXT.$SENT_EXT" ]; then
            echo "All files sent" &gt;&gt; $baselog
            echo&gt;$FILE_ON_COMPLETE
  #         $FILE_ON_COMPLETE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR"
            rm "$basedirectory$FEATURE_EXT.$SENT_EXT"
            rm "$basedirectory$KEYART_EXT.$SENT_EXT"
            rm "$basedirectory$TRAILER_EXT.$SENT_EXT"
            rm "$basedirectory$METADATA_EXT.$SENT_EXT"
            rm $FILE_ON_COMPLETE
          fi
  
       fi
     fi
  fi
  </code></pre>