Created
August 17, 2016 01:50
-
-
Save ShigekiKarita/887837de70e30d8ad7ec296f3e08c3ef to your computer and use it in GitHub Desktop.
"GNU Make 第3版 - O'Reilly Japan"をダウンロードして結合するスクリプト
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
root=http://www.oreilly.co.jp/library/4873112699/ | |
files=`curl ${root} 2> /dev/null | grep pdf | cut -d \" -f2 | sed -n '2,21p'` | |
# download | |
printf '%s\n' $files | xargs -I{} wget ${root}{} | |
# merge | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=gnumake.pdf $files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L2の
curl ${root} 2> /dev/null | grep pdf | cut -d \" -f2 | sed -n '2,21p'
の部分ですが、現在oreillyのサイトがssl対応したことにより、httpsにリダイレクトしようとしこのスクリプトが正常に動作しないみたいです。なので
curl -L
オプションを付けて対応すると良さそうです。