Skip to content

Commit

Permalink
Merge pull request #2 from dschep/cleanup
Browse files Browse the repository at this point in the history
Delete file if upload successful
  • Loading branch information
Ceryn committed Oct 23, 2014
2 parents e650090 + e542414 commit 34fe0b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion img.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ scrot -z "$@" $img >/dev/null 2>&1 || exit
res=$(curl -sH "Authorization: Client-ID $clientid" -F "image=@$img" "https://api.imgur.com/3/upload")

echo $res | grep -qo '"status":200' && link=$(echo $res | sed -e 's/.*"link":"\([^"]*\).*/\1/' -e 's/\\//g')
test -n "$link" && (printf $link | xclip; printf "\a") || echo "$res" > "$img.error"
test -n "$link" && (printf $link | xclip; printf "\a" && rm "$img") || echo "$res" > "$img.error"

0 comments on commit 34fe0b0

Please sign in to comment.