Archive

Archive for the ‘twitter’ Category

Tweet using bash!

July 18, 2009 4 comments

#!/bin/bash
# Store this file with whatever the name in /usr/local/bin/
# SYNTAX: twit Your_message_here
###### You cannot twit nothing! ####################
if [ -z “$1” ]
then
echo “Dude, enter some message, it can’t be blank! Come on!”
exit
fi
message=”$@”
####### Check the length to stop the request from failing #######
max_length=”140″
length=”${#message}”
echo “Message: ” $message
#echo $length
if [ $length -gt $max_length ]
then
echo “Dude, bada lamba message hai, only 140 chars allowed at a time…..It is a microblogging website, yes they are having shortage of space”
exit
fi
########## Enter your username password ##############
username=”username”
password=”password”
url=”http://twitter.com/statuses/update.xml”
curl –basic –user $username:$password –data status=”$message” $url

I wrote this small script which lets you twit through your terminal
Yes $HTTP_PROXY needs to be set

Enter your username and password in the file
and you are done!

PS: Yeah I know many such scripts exist! I never said this is new 🙂

Categories: bash, linux, twitter Tags: , , , ,
%d bloggers like this: