Tweet from the command line

Do this from the command line

curl -u username:password -d status="the message" http://twitter.com/statuses/update.xml

Add the following function in your .bashrc file.

# function to tweet
tweet() {
  flag=0
  if [[ -z "$1" && -z "$2" ]]; then
    echo "Usage: tweet password \"message\""
    echo "Make sure the message is within quotes"
    flag=1;
  fi
  if [ ${flag} == "0" ]; then
    echo "Sending message...."
    curl -u username:$1 -d status="$2" http://twitter.com/statuses/update.xml
  fi
}


and then do
$tweet password "The message goes here"

[Source]

No comments: