Post to twitter from command line

Works in the Mac OS terminal, and on Linux if you install curl.

#! /bin/sh
curl  --basic --user "username:password"
        --data-ascii "status=`echo $@|tr ' ' '+'`"
          "" > /dev/null

Update of something I found from 2007, when twitter was using a different API by the look of it.

The curl command line should all be on one line, no line breaks. I’ve had to add line breaks here so the line does not disappear into the sidebar. The redirect to /dev/null simply suppresses the 20 lines of xml that are returned by twitter when the twit is received.

If I used the short version of the—user option to curl, and if I put up with the xml output, I could have a script that posts to twitter that I could tweet.

Comments are closed.