title: multiple cURL downloading with 404 detection
body: <p>I'm trying to write a shell script that downloads files using cURL and detects if a url leads to a 404 error. If a url is a 404 then I want to save the url link or filename to a text file.</p>
  
  <p>The url format is <a href="http://server.com/somefile[00-31].txt" rel="nofollow">http://server.com/somefile[00-31].txt</a></p>
  
  <p>I've been messing around with what I've found on google and currently have the following code:</p>
  
  <pre><code>#!/bin/bash
  
  if curl --fail -O "http://server.com/somefile[00-31].mp4"
  then
    echo "$var" &gt;&gt; "files.txt"    
  else
    echo "Saved!"
  fi
  </code></pre>