Showing posts with label twitter. Show all posts
Showing posts with label twitter. Show all posts

How to tweet from command line

First, make sure you have "curl" install on your machine.
if not, install it with
"yum" or "apt-get".










Create a new script with your favorite editor, i like vi
# vi /usr/bin/tweet (as root user)
and copy the next lines to it.

#!/bin/sh

tweet="${@}"
user="USER"
pass="PASSWORD"

if [ $(echo "${tweet}" | wc -c) -gt 140 ]; then
echo "FATAL: The tweet is longer than 140 characters!"
exit 1
fi

curl -k -u ${user}:${pass} -d status="${tweet}" https://twitter.com/statuses/update.xml >/dev/null 2>&1

if [ $? == "0" ]; then
echo "Successful tweet!"
fi

Change the USER to your user name and the PASSWORD to your twitter password.
save and run the command:
# chmod +x /usr/bin/tweet

that's it.

run from your command line
# tweet "Testing tweet sctipt"

and you are twitting.

Read more >>