title: how to re-run the "curl" command automatically when the error occurs
body: <p>Sometimes when I execute a bash script with the <code>curl</code> command to upload some files to my ftp server, it will return some error like:</p>
  
  <pre><code>56 response reading failed
  </code></pre>
  
  <p>and I have to find the wrong line and re-run them manually and it will be OK.</p>
  
  <p>I'm wondering if that could be re-run automatically when the error occurs.</p>
  
  <hr>
  
  <p>My scripts is like this:</p>
  
  <pre><code>#there are some files(A,B,C,D,E) in my to_upload directory,
  # which I'm trying to upload to my ftp server with curl command
  for files in `ls` ;
      do curl -T $files ftp.myserver.com --user ID:pw ;
  done
  </code></pre>
  
  <p>But sometimes A,B,C, would be uploaded successfully, only D were left with an "error 56", so I have to rerun curl command manually.  Besides, as Will Bickford said, I prefer that no confirmation will be required, because I'm always asleep at the time the script is running. :)</p>