Last active
August 18, 2021 07:28
-
-
Save eggplants/3e843b7681581efb908a2cbb22595550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
command -v gs > /dev/null || { | |
echo "gs(ghostscript) is not found">&2 | |
exit 1 | |
} | |
command -v curl > /dev/null || { | |
echo "curl is not found">&2 | |
exit 1 | |
} | |
BASE=https://www.oreilly.co.jp/library/4873112699/ | |
TMPDIR="$(mktemp -d)" | |
curl -s "$BASE" | sed -nE 's;^.*"([^/"]+pdf)".*$;\1;p' | | |
sed "s;^;${BASE};g" | while read -r i | |
do | |
curl "$i" -o "$TMPDIR/$((cnt++)).pdf" | |
done | |
ls -tr "$TMPDIR" | sed "s;^;${TMPDIR}/;g" | | |
xargs gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=gnu-make-book.pdf | |
rm -rf "$TMPDIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPT=make-make-book.sh | |
all: $(SCRIPT) | |
bash $(SCRIPT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment