scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

commit 43fe523e8973b53459b1710da07b725b7e51fba0
parent cc16801dc6168830df73f3a0085dae4cb5b04986
Author: sin <sin@2f30.org>
Date:   Fri Jul  5 18:48:57 +0100

Fix indentation + other crap

Diffstat:
4chandownload.sh | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/4chandownload.sh b/4chandownload.sh @@ -1,7 +1,7 @@ #!/bin/sh -if [ "$1" = "" ]; then - echo "Usage: `basename $0` <4chan thread url>" +if [ ! $# -eq 1 ]; then + echo "Usage: $(basename $0) <4chan thread url>" exit 1 fi @@ -10,9 +10,7 @@ echo "Downloading until canceled or 404'd" LOC=$( echo "$1" | egrep -o '([0-9]*)$' | sed 's/\.html//g' ) echo "Downloading to $LOC" -if [ ! -d $LOC ]; then - mkdir $LOC -fi +mkdir -p $LOC cd $LOC @@ -29,9 +27,9 @@ while [ true ]; do egrep '//images.4chan.org/[a-z0-9]+/src/([0-9]*).(jpg|png|gif)' "$TMP" -o | uniq > "$TMP2" - sed 's|//images|http://images|g' $TMP2 > $TMP + sed 's|//images|http://images|g' $TMP2 > $TMP - cat $TMP | xargs -P 5 -I _URL_ $WGET_CMD _URL_ + cat $TMP | xargs -P 5 -I _URL_ $WGET_CMD _URL_ rm $TMP $TMP2