Ubuntu: Twittering from the command line

I found this neat post in Hackszine recently. It shows a cool way of posting to twitter from your command line.

1.Let us convert it into a shell script. Open your favorite editor and create a file called twitter and enter these in it. (replace username and password with yours)

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

2. Save the file and change the permission
$ sudo chmod u+x twitter

3. Now, let us try our cool twitter script
$ ./twitter "shell twitter script is up and running"

If you don't have curl, you'll need to get it via apt. It's simple..

$ sudo apt-get install curl

Once the twitter script finishes sending the post, it sends back an acknowledgment in form of an xml response with your account details.

Hope you had fun experimenting with twitter, I definitely did ;)