scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 3672216648b26444310c3c1bb5d4cd29aa9881a5
parent 185e52b8e623acceb313a43275416246ea67ee64
Author: z3bra <willy@mailoo.org>
Date:   Sat Dec  6 12:37:50 +0100

imgurup: use stdin when no args provided

Diffstat:
imgurup | 15++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/imgurup b/imgurup @@ -4,21 +4,14 @@ # appends links and deletion links to the log # depends: curl -# check if all args exist as files -for F in "$@"; do - if ! test -f "$F"; then - echo usage: $(basename $0) image ... && exit 1 - fi -done +# use stdin if no file provided +test -z "$@" && FILES='-' || FILES="$@" LOG=$HOME/.imgurlog # from http://imgur.com/tools/imgurbash.sh APIKEY='b3625162d3418ac51a9ee805b1840452' -# use stdin if no file provided -test -z "$@" && FILES='-' || FILES="$@" - # upload all for IMG in "$FILES"; do RESP=$(curl -F "image=@$IMG" -F "key=$APIKEY" \ @@ -27,7 +20,7 @@ for IMG in "$FILES"; do URL=$(echo $RESP | sed 's|.*<original_image>\(.*\)</original_image>.*|\1|') DELETEURL=$(echo $RESP | sed 's|.*<delete_page>\(.*\)</delete_page>.*|\1|') - echo "$URL" | tee $LOG - echo "$DELETEURL" >> $LOG + echo "$URL" > $LOG + echo "$DELETEURL" >> $LOG echo "$URL" done