百度短网址转换

#! /bin/bash
#百度短网址转换
# Author suiang

LANG=en_US.UTF-8
URL=`yad --entry --title="短网址" --text="输入需要转换的网址" --entry-label="网址:" --button="取消:1" --button="转换:2" --width=300 --height=100`

ret=$?

[[ $ret -eq 1 ]] && exit 0

if [[ $ret -eq 2 ]]; then
   tmpfile=`mktemp -t dwz.json.XXXXXX`
   json=$(curl -d "url=$URL" http://dwz.cn/create.php)
   echo $json | sed -e 's/{/\l/g ; s/}/\l/g ; s/,/\n/g ; s/\\/\l/g ; s/\"/\l/g' >> $tmpfile
   status=`grep "status" $tmpfile | cut -d: -f2`
   if [ $status = "0" ]; then
   tinyurl=`grep "tinyurl" $tmpfile | cut -d: -f2-3`
   echo $tinyurl | xclip -selection clipboard
   notify-send -h int:transient:1 -t 3000 -u normal --icon=dialog-ok "短网址 - 成功" "转换成功,短网址已复制到剪贴板!"
   else
   notify-send -h int:transient:1 -t 3000 -u normal --icon=dialog-error "短网址 - 错误" "$err_msg"
   fi
   rm -f $tmpfile
   exit 0
fi

QQ截图20131105112651.png

QQ截图20131105112704.png

http://dwz.cn/9zeH3

技术顶起来,签名也写在里面啦哈哈,,:4_102: