Skip to content

Instantly share code, notes, and snippets.

@ShigekiKarita
Created August 17, 2016 01:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShigekiKarita/887837de70e30d8ad7ec296f3e08c3ef to your computer and use it in GitHub Desktop.
Save ShigekiKarita/887837de70e30d8ad7ec296f3e08c3ef to your computer and use it in GitHub Desktop.
"GNU Make 第3版 - O'Reilly Japan"をダウンロードして結合するスクリプト
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
@sashiyama
Copy link

L2のcurl ${root} 2> /dev/null | grep pdf | cut -d \" -f2 | sed -n '2,21p'の部分ですが、現在oreillyのサイトがssl対応したことにより、httpsにリダイレクトしようとしこのスクリプトが正常に動作しないみたいです。
なのでcurl -Lオプションを付けて対応すると良さそうです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment