tinyurl etc on the command line

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. I'm not set on tinyurl.com, any of the alternatives will do. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/

On Mon, Nov 12, 2012, at 08:57 PM, 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. I'm not set on tinyurl.com, any of the alternatives will do.
turl http://alphahelical.com/code/scripts/turl/ Regards Graeme

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 regards, Glenn -- sks-keyservers.net 0xb1e82ec9228ac090

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 "" -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/

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.

On Tue, 13 Nov 2012, "Trent W. Buck" <trentbuck@gmail.com> wrote:
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.
Thanks for the suggestion. I've put in quotes. I'm not going to use -sf because I don't plan to use it in scripts at this time, I just want something faster than firing up a new browser window just to visit a web site. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/

Russell Coker wrote:
On Tue, 13 Nov 2012, "Trent W. Buck" <trentbuck@gmail.com> wrote:
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.
Thanks for the suggestion. I've put in quotes. I'm not going to use -sf because I don't plan to use it in scripts at this time, I just want something faster than firing up a new browser window just to visit a web site.
IMO you should be using -f if you're using set -e... Otherwise 4xx don't propagate upwards as errors.
participants (5)
-
Glenn McIntosh
-
Graeme Cross
-
Russell Coker
-
Trent W. Buck
-
trentbuck@gmail.com