MbNew version, new name, 2011-04-22

Elaborations on the theme of anothy’s original tweet. Occasionally useful as prototype API poking sticks during development of larger clients for other systems — and of course to keep up with the web joneses from the comfort and safety of Plan 9.

These files are available in the Bell Labs Plan 9 sources contrib area, i.e., /n/sources/contrib/josh/rc/mb.


read, write – simple microblogging


mb/read [ –pr ] [ –h url ] [ user ]
mb/write [ –d ] [ –h url ] [ text ... ]


These rc(1) scripts are simple clients for reading and writing on microblogs; that is, short message publication services that implement the so–called Twitter API.

Read prints on the standard output a microblog user user’s “Personal Timeline” at the API root URL url. In the absence of –h, the value of the environment variable mbapiurl, if any, is used. If no user is given, the environment variable mbuser is consulted. If $mbuser is in turn empty, $user is presumed as the remote user name. Under –r, read prints only replies sent to the user. Option –p prints the entire “Public Timeline”.

Write publishes text to the microblog service at the API root url. If –h is omitted, write uses the value of the environment variable mbapiurl for the service URL. If text is not given, a single line is read from standard input. The –d flag prints the server response (in XML format) on standard error.

Both programs query factotum(4) for authentication as needed.


Read the Identi.ca home timeline of screenname glenda:

mb/read –h https://identi.ca/api glenda

Read the Twitter home timeline of the authenticated user:

mb/read –h http://api.supertweet.net/1




hget(1), read in cat(1)
http://status.net, “StatusNet”
http://apiwiki.twitter.com, “Twitter API Wiki”
http://www.supertweet.net, “Twitter API Proxy”


Write refuses text <1 or >140 runes, exiting with status length.


The user argument and the mbuser environment variable have no effect when reading Twitter via the known API proxy, which exposes only an authenticated user’s timelines.