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 one for me? I was thinking to use curl.
Asked
Active
Viewed 481 times
1 Answers
2
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

nmat
- 7,430
- 6
- 30
- 43