title: Check ftp upload with wget and retry if necessary
body: <p>I have a minor bash script loop I'm trying to learn and accomplish but it's giving me a hard time to comprehend with all the readings I've done. </p>
  
  <p>I am uploading to a ftp server, then I want to check to see if the upload went through successfully by using wget spider method. If it returns OK then we're good, if not then I want to redo the ftp upload once more.</p>
  
  <p>The code I have below are based on my research and learning from here. If I could be doing this better, please help me revise it so I can learn from it.</p>
  
  <pre><code>for ((i = 0 ; i &lt; 1 ; i++ )); 
  do 
      wget_output=$(wget -q --spider "http://$FTP_HOST/test.jpg")
      if [ $? -ne 0 ]; 
      then
          ftp -in $FTP_HOST &lt;&lt;ENDFTP
  user $FTP_USER $FTP_PASSWORD
  binary
  put dEdLWOcOfPRqBU1.mp4.jpg
  bye
  ENDFTP
          $i="1";
      else
          echo "SQL CODE HERE"    
      fi
  done
  </code></pre>
  
  <p>The error when executing is: </p>
  
  <pre><code>line 28: syntax error: unexpected end of file
  </code></pre>