This is a subject that has been covered time and time again but I don’t think that it will hurt one more time. Twitter is a very popular “Microblogging” site where you can constantly change your status to let those who “follow” you know what you are doing. Since I just signed up for twitter for The Linux Blog I figured I’d write this post on how I update my twitter feed. While I’m at it I might as well invite you over to my feed URL: http://twitter.com/linuxblog
So here is the script:
#!/bin/bash echo "Enter Tweet: "; read inputline; TWEET="$inputline"; curl -u user:password -s -F status="$inputline" http://twitter.com/statuses/update.xml http://twitter.com/account/end_session
This is a very basic twitter script, it does no error checking and probably doesn’t escape characters properly. None the less it works. The part that gets input from the shell is the following line:
read inputline; TWEET="$inputline";
If you’d like more information on how this works read this article: Shell Script to get user input
Curl is used to send the data to Twitter, to view curl tutorials and how-to’s visit the Curl Man Page which has a wealth of information at the bottom.
Until next time, happy tweeting!