Sunday, April 04, 2010

tweeting from the BASH terminal

i feel this an awesome script..tweet from command line terminal in linux..
script is as follows:

#!/bin/bash

username="yourUserName" ;
password="yourPassword";

URL="http://twitter.com/statuses/update.xml" ;

if [ $(echo "$1" | wc -c ) -gt 140 ]
then
echo "Whoo: Its more than 140 characters"
exit 0;
fi

result=$(curl -u $username:$password -d status="$1" $URL) ;

exit 0 ;

save this in some file name "tweet" and make it executable ( chmod +x tweet )
And for simplicty add an alias ..
Now tweet from terminal using the command
tweet "tweeting from the command line"

No comments:

Post a Comment