bin zsh if -z then echo Specify file to upload exit fi TMP nocorrect c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#!/bin/zsh
if [ -z "$1" ];then
echo "Specify a file to upload!"
exit
fi
TMP=$(nocorrect curl -H Expect: \
-F fileupload=@"$1" \
-F xml=yes \
http://www.imageshack.us/index.php)
echo $TMP
URL=$(echo $TMP | perl -ne \
'print m,<image_link>(http://img\d+\.imageshack\.us/img\d+/\d+/.+)</image_link>,')
echo -n $URL | xclip -i
echo $(xclip -o)