TWITTER STATUS UPDATE
By: a guest | Mar 22nd, 2010 | Syntax:
None | Size: 0.77 KB | Hits: 138 | Expires: Never
#!/bin/bash
#Creator: REMOVED
#Date: 22MAR10
#Purpose: System Messages are sent to Private Twitter Account
#Notes: It's important that you chmod x-r-w- this file.
YOURACCOUNT=""
YOURPASS=""
#VALIDATES MESSAGE LENGTH
SIZELIMIT="$(cat /tmp/twittermsg |wc -m)"
if [[ ${SIZELIMIT} > 140 ]]; then
echo -e "\033[31;10;1mYour message is too long!!\033[m"
echo ""
echo -en "\033[31;10;1mHere is what would be uploaded to Twitter :\033[m "; cat /tmp/twittermsg |cut -c 1-140
exit
elif [[ ${SIZELIMIT} < 140 ]]; then
#SENDS YOUR MESSAGE TO TWITTER
MESSAGE="$(cat /tmp/twittermsg)"
curl -u ${YOURACCOUNT}:${YOURPASS} -d status="${MESSAGE}" http://twitter.com/statuses/update.xml
#EMPTY THE CONTENTS OF MESSAGE FILE AFTER SUCCESSFUL UPDATE
echo "" > /tmp/twittermsg
fi