March 23, 2009

Tweet from the command line

Twitter is awesome, but who has time to fire up a browser, log in, type what you’re doing, just to be a part of the Twitter sensation?   If you spend more of your time on the command line, I’ll show you how to send your twitter messages using a simple bash script.

#!/bin/bash

user=twitteruser
pass=twitterpass
tweet=$1
curl -u ${user}:${pass} -d status=${tweet} http://twitter.com/statuses/update.xml

Save this bash script in your ~/bin directory and chmod 700.  Now you can tweet right from the command line.

tweet "Twitter is better from the command line"

If you’d rather not put your password in a text file (think multi-user systems) then, take out the “:${pass}” and curl will ask for it each time you run the “tweet” script.

[...] I showed you how to tweet from the command line. It’s even easier to follow your twitter network from the command [...]

Pingback by joshclarkson.net » Blog Archive » Following Twitter from the Command Line — November 28, 2009 @ 12:39 pm

Leave a comment