There are many reasons you might want to tweet from the shell. Mine is that I want to be able to send one-liners in to evernote directly from terminal. I looked it up and found that since Twitter has updated to using Oauth for their API this has become much more diffucult. But there is a work around that doesn’t involve using oauth libs.
Enter Super Tweet: They provide a proxy to the twitter API which allows you to still use basic authentication to send tweets. You can sign up here: http://supertweet.net .
Once you have a Super Tweet account set up, create an auth file in your home directory with your Super Tweet account info as fallows:
Resist the urge to call your auth file something like “twitter_password” and make sure to change the premissions so that only you can view it. I called my file “.twitter_a”.
Then just create this one line script:
curl -u `cat ~/.twitter_a` -d status="$*" http://api.supertweet.net/statuses/update.xml
You can now use the script like so:
./tweet.sh my awesome tweet goes here
This is all bare bones and it leaves a lot to be desired, but hey it works! Feel free to modify it and come up with your own uses for twitter in the CLI.