How to Tweet from Shell Script

Hi guys,
recently i turned to be an avid twitter user and i found that it is too difficult to open the browser or some other app to tweet every time.So i made a small shell script to tweet.I shared the code below.

#LICENSE : Just send a mail.I will be so happy if you do 😉
#BalaTwitSoon.sh

#!/bin/bash
#coded by balachandar.km balachandarlinks@gmail.com
user='<Your Twitter User Name>’;
pass='<Your Twitter Password>’;
mess=`zenity –title=”Enter the Tweet” –text=”Tweet Tweet Tweet ” –entry`;
if [ -z “$mess” ]
then
zenity –title=”Tweet Result” –timeout=3 –text=”Tweet canceled” –info;
else
curl –basic –user “$user:$pass” –data-ascii “status=$mess” http://twitter.com/statuses/update.json;
zenity –title=”Tweet Result” –timeout=3 –text=”Successfully Tweeted” –info;
fi


Just copy the code and save it as a shell file and just make shortcut of it to your desktop or run it at constant intervals with the help of sleep command.It really helps me tweet often.I used the “curl” tool to post the http request and found Zenity is quite handy for this purpose.

Screen shot :

BalaTwitSoon Screenshot
BalaTwitSoon

Happy tweeting.Your experiences are most welcomed 😉

Advertisements

2 thoughts on “How to Tweet from Shell Script

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s