Merge pull request #2 from dschep/cleanup

Delete file if upload successful
master
Ceryn 2014-10-23 23:49:03 +02:00
commit 34fe0b0eb2
1 changed files with 1 additions and 1 deletions

2
img.sh
View File

@ -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"