Helical Alpha Code

turl: command-line tinyurl.com client

I don't know about you, but I use tinyurl.com all the time. What I don't like is having to fire up a web browser and view two pages just to get a tinyurl to put in an email or IM conversation.

Yes, yes, yes. I know I could GET it like so:

"http://tinyurl.com/create.php?url=google.com"

Who wants to type that much? That's nearly as bad as using the web form. And besides, once you have a Unix/*nix utility to do it, there's no end to the fun you can have!

So I wrote turl. turl will read a url either from the command line or from stdin, query the tinyurl.com server, parse the returned page, and return a newline-terminated tinyurl to stdout. the script makes use of user-agents already installed on most *nix machines: curl, lynx, links, wget. In addition, for those users who don't have access to a supported user-agent, a telnet/expect user-agent is built in, and a PERL user-agent is in the works.

Source and download are forthcoming.

turl | Download Source | View Source