Share Pastebin
Guest
Public paste!

TWITTER STATUS UPDATE

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