Linux.com

Re:check error code

Posted by: Anonymous Coward on January 17, 2007 04:42 AM
Instead of just giving up the show, why not just dump the current non-working url to the bottom of the list, and move on to the next? I know this will present a possible never ending loop if the server is perpetually broken, and it's the only url left in the list, but I think this is better:
<tt>  url=`head -n1<nobr> <wbr></nobr>.wget-list`
      wget -c $url
ERRORCODE=$?
if [ $ERRORCODE -eq 0 ]; then
      sed -si 1d<nobr> <wbr></nobr>.wget-list
else
      echo "ERROR: could not get $url" 1>&2
      echo $url >><nobr> <wbr></nobr>.wget-list
fi</tt>

#

Return to Make Wget cater to your needs