#!/bin/bash
#usage: ./cornell_book.sh "[topic]/[book_number]" [from] [to]
#e.g.: ./cornell_book.sh "math/05090001" 5 10

# To make use of this script, you have to go to the Cornell site
# http://library5.library.cornell.edu/ with some graphical browser
# and find the id-string of your chosen book. It looks like math/05090001
# or something. It's the part enclosed between ``library.'' and ``?part''.
# Then you make a directory where you want the book to be downloaded
# and run this script with the id-string and from-to number of pages
# you want to download. Don't forget the obvious chmod +x first!
#
# If there are problems, please let me know at hanke@volny.cz.
# If you find a way how to use wget with this script, PLEASE let me know.
#
# Please use freely (as in freedom) as you want, no copyright.

a="http://library5.library.cornell.edu/Dienst/Repository/1.0/Disseminate/cornell.library."
b="?part=document%3bimage%3d"
c="&content-type=image/gif&size=6"

for i in `seq $2 $3`
do
name="$a$1$b$i$c"
lynx -source "$name" > $i.gif
echo "Page "$i" downloaded"
done

