Thursday, 5 February 2009

CLI tweets

Another quicky - Twittering from the command line:

$ curl --basic --user "username:password" --data-ascii "status=Twittering from the commandline" "http://twitter.com/statuses/update.json"

Wrapped in a very simple script:

#!/bin/bash

if [ ${#} -gt 0 ]; then
   STATUS="${*}"
else
   STATUS="$(cat -)"
fi

curl --basic --user "username:password" --data-ascii "status=${STATUS}" "http://twitter.com/statuses/update.json"