
Russell Coker <russell@coker.com.au> writes:
On Mon, 12 Nov 2012, Glenn McIntosh <neonsignal@memepress.org> wrote:
On 12/11/12 20:57, Russell Coker wrote:
Does anyone know of a Linux client for tinyurl or some similar service? I'd like to run "tiny http://www.example.com/whatever" and have a single line of output being the tiny URL.
curl http://tinyurl.com/api-create.php?url=http://www.example.com
Thanks for that. The turl script seemed overly complex and I prefer things that are easy to understand. So I used the following:
$ cat ~/bin/tinyurl #!/bin/bash set -e curl http://tinyurl.com/api-create.php?url=$1 echo ""
Suggest curl -sf. I'm also surprised the API returns as the body, when IMO the 301 is more logical -- which would be -sfw'%{redirect_url}', possibly with an -I for good measure. "" to the echo is superfluous. Should have quotes around the $1 though.