OSCHINA数据通知提醒

前端之家收集整理的这篇文章主要介绍了OSCHINA数据通知提醒前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面是编程之家 jb51.cc 通过网络收集整理的代码片段。

编程之家小编现在分享给大家,也给大家做个参考。

#!/bin/bash

USERNAME="[email protected]"
PWD="xxxxxxxxxxxxx"
API_LOGIN_VALIDATE="http://www.oschina.net/action/api/login_validate"
API_USER_NOTICE="http://www.oschina.net/action/api/user_notice"

DATA_LOGIN=$(curl -d "username="$USERNAME"&pwd="$PWD"&keep_login=1" -c /tmp/osc.cookie  $API_LOGIN_VALIDATE 2>&1)
DATA_OSC_UID=$(echo "$DATA_LOGIN" | grep '<uid' | cut -f2 -d">"|cut -f1 -d"<")
DATA_USER_NOTICE=$(curl -d "uid=$DATA_OSC_UID" -b /tmp/osc.cookie  $API_USER_NOTICE 2>&1)

atmeCount=$(echo "$DATA_USER_NOTICE" | grep '<atmeCount' | cut -f2 -d">"|cut -f1 -d"<")
msgCount=$(echo "$DATA_USER_NOTICE" | grep '<msgCount' | cut -f2 -d">"|cut -f1 -d"<")
reviewCount=$(echo "$DATA_USER_NOTICE" | grep '<reviewCount' | cut -f2 -d">"|cut -f1 -d"<")
newFansCount=$(echo "$DATA_USER_NOTICE" | grep '<newFansCount' | cut -f2 -d">"|cut -f1 -d"<")

if [ $atmeCount != "0" ] ||  [ $msgCount != "0" ]   ||  [ $reviewCount != "0" ]   ||  [ $newFansCount != "0" ] 
then
   notify-send  "OSChina通知" "数据:$atmeCount / $msgCount / $reviewCount / $newFansCount" 
fi

以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

猜你在找的Shell相关文章