mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-22 13:01:06 -05:00
use shell variable instead of alias
for switching xmlstarlet command. bash doesn't like aliases.
This commit is contained in:
@@ -11,12 +11,17 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# xmlstarlet is often just xml
|
# xmlstarlet is often just xml
|
||||||
if ! which xmlstarlet >> /dev/null && which xml >> /dev/null; then
|
if which xmlstarlet >> /dev/null; then
|
||||||
alias xmlstarlet=xml
|
XMLSTARLET=xmlstarled
|
||||||
|
elif which xml >> /dev/null; then
|
||||||
|
XMLSTARLET=xml
|
||||||
|
else
|
||||||
|
echo "xmlstarlet not found :("
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
twitter_total=$(curl -s "http://api.twitter.com/1/users/lookup.xml?screen_name=$1" |
|
twitter_total=$(curl -s "http://api.twitter.com/1/users/lookup.xml?screen_name=$1" |
|
||||||
xmlstarlet sel -t -m "//users/user/statuses_count" -v .)
|
$XMLSTARLET sel -t -m "//users/user/statuses_count" -v .)
|
||||||
|
|
||||||
if ! test "$twitter_total" -gt 0 2>/dev/null
|
if ! test "$twitter_total" -gt 0 2>/dev/null
|
||||||
then
|
then
|
||||||
@@ -67,7 +72,7 @@ EOF_ED2
|
|||||||
|
|
||||||
grep -iE 'rate|status' $temp2 # show the interesting twitter rate limits
|
grep -iE 'rate|status' $temp2 # show the interesting twitter rate limits
|
||||||
|
|
||||||
if test "$(xmlstarlet sel -t -v "count(//statuses/status)" $temp 2>/dev/null)" -eq 0
|
if test "$($XMLSTARLET sel -t -v "count(//statuses/status)" $temp 2>/dev/null)" -eq 0
|
||||||
then
|
then
|
||||||
head $temp | grep -q "Over capacity" && echo "Twitter is OVER CAPACITY"
|
head $temp | grep -q "Over capacity" && echo "Twitter is OVER CAPACITY"
|
||||||
if test "$2" && test "$since"
|
if test "$2" && test "$since"
|
||||||
@@ -85,7 +90,7 @@ fi
|
|||||||
|
|
||||||
shortDomains="t.co bit.ly tinyurl.com goo.gl"
|
shortDomains="t.co bit.ly tinyurl.com goo.gl"
|
||||||
|
|
||||||
xmlstarlet sel -t -m "statuses/status" -n -o "text " -v "id" -o "|" -v "created_at" -o "|" -v "normalize-space(text)" \
|
$XMLSTARLET sel -t -m "statuses/status" -n -o "text " -v "id" -o "|" -v "created_at" -o "|" -v "normalize-space(text)" \
|
||||||
-m "entities/urls/url" -i "expanded_url != ''" -n -o "url " -v "url" -o " " -v "expanded_url" $temp | {
|
-m "entities/urls/url" -i "expanded_url != ''" -n -o "url " -v "url" -o " " -v "expanded_url" $temp | {
|
||||||
|
|
||||||
while read -r first rest
|
while read -r first rest
|
||||||
|
|||||||
Reference in New Issue
Block a user