Twitter commandline tool
Since a couple of days I integrated twitter status updates in my blog. Just for the fun of it. Now I need something easy to post new status messages to twitter. Sure there is the twitter website that you can use to do that but it requires me to logon and then type the status etc. I get tired of just thinking about all that. To ease the pain I added SMS as a channel and added twitter to my instant messenger program. So instead of chatting to a person I can send an update to twitter. This is already much better but I’m really lazy. Basically I want just a small commandline tool that sends the argument I specify as status message to twitter.
Due to the twitter API this is really easy using wget (or you could use curl if you more into that). The script is basically a one-liner that posts the message to twitter. Put the script below in a file (I put it in a file called ‘twitter’). Replace USER with your twitter username and replace PW with your password. Make the file executable and you are ready to go. Here it is:
#!/bin/sh
wget --post-data="status=$@" -q -O - \
"http://USER:PW@twitter.com/statuses/update.json"
Now you can post a message to twitter using:
./twitter "Just bought the new Joe Jackson CD"
Have fun!