Automate ImageShack upload
I can't figure out how to make a script to upload a picture to ImageShack, and return the hotlink of the picture in BASH, can anybody whip up 开发者_如何学Goone for me? I was thinking to use curl.
Here is my solution:
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: `basename $0` filename"
exit
fi
image="$1"
mimetype=`file -b --mime-type $image`
curl -H Expect: -F "fileupload=@$image;type=$mimetype" -F xml=yes -# "http://post.imageshack.us/" | grep image_link | grep -o http[^\<]*
If you don't like the progress bar, just replace -#
with -s
精彩评论