A bash script to fetch files from the Django website.

Example usage:

cd ~/mytemplates
djget http://code.djangoproject.com/browser/djangoproject.com/django_website/templates/base_community.html

This fetches the named file and puts it in the current directory with the basename which, in this case, is base_community.html.

Here is the script:

#! /bin/bash
filebasename=`basename ${filename}`
wget ${wgetfilename}
if [ $? = 0 ]; then
    mv ${filebasename}?format=txt ${filebasename}
    echo wget failed for ${filename}

Comment: You could just use wget's "-O" parameter to specify the output file directly, the script could be a one-liner

wget -O `basename $1` "$1?format=txt"
Last modified 6 years ago Last modified on 02/02/2010 12:30:46 AM
Back to Top