During the last week, I've learned to use Twitter. Of course, there is not a lot to learn as Twitter is a really simple system. Consequently, it can easily be updated from the Linux command line without using any dedicated application or a bloated web browser. You just need to have curl installed on the system to use the following command:
curl -u "username:password" -d "status=here comes the status update" http://www.twitter.com/statuses/update.xml
And to make it even simpler, you can write a simple script to send the updates from the command line:
#!/bin/bash
echo "Twitter update: $1"
curl -u "username:password" -d "status=$1" http://www.twitter.com/statuses/update.xml >/dev/null
After saving the script as tw I made it executable. Now I can send updates with:
tw "This is my update"
If you intend to send a lot of tweets from the command line, you should probably add some sanity checks to the script.
Edit: I added >/dev/null to the end of the third line in the script in order to reduce the amount of text output.
6 comments:
this is an excellent script, simple yet effective - will be of great use, thanks :)
Really awesome! This is what I've been looking for in a long time!
Would be good to make the username and password be parameters to be passed from the command line as well. This way any user of the machine could use it! ;)
Puleen: True, if one wants to have a real commandline tweeter. But I wanted to have something that does not require me to take care of logging in.
Another possibility would be to make the script read the username and password from ~/.twconf.
I've been using this perl-based script for quite some time now. Might be interesting for you to look into, as it also fetches your twitter stream, allows for direct messages and lets you follow new people, all from the CLI :)
Or you could install twidge
Post a Comment