/bin/bashing bit.ly

bit.ly is a link-shortening service run by one bit.ly Inc. of New York city. I’m sure you’ve all used one such service by now. You have a big link, such as my last Google search:

http://www.google.ie/search?hl=en&q=what+is+this+strange+growth+and+why+does+it+smell&aq=f&aqi=&aql=&oq=&gs_rfai=

Now, while all the cool-kid websites use dynamic pages that spit out lengthy, solid, robust (and dynamic) URLs such as this, you can’t easily drop them into a tweet while still leaving room for an additional message. Observe:

177 characters! Totally, totally unsuitable!

Enter bit.ly. A quick application of their link-shortening magic and I have a much more tweet-friendly URL with which I can begin a conversation about my strange growth:

http://bit.ly/a9SAHq

Screenie…recap.

In my discussion of screenie 2.0, and its integration of bit.ly link-shortening, I briefly mentioned how I would really enjoy having the ability to shorten links via pipes in shell scripts. What I want is the ability to either pipe in a URL for shortening, or simply give it the URL for shortening. Examples:


wget //ix.bhalash.com/u/4144919/directions2.jpg | bitly | xclip -sel clip

or


tweet "Check out this cool photo of my son: $(bitly //ix.bhalash.com/u/4144919/directions2.jpg)"

or


echo "Adorable photo of Garrett: $(bitly //ix.bhalash.com/u/4144919/directions2.jpg)" | mail -s "Cute, cute photo of Garrett!" bill@bob.com

You get the general idea.

To achieve either, I need to create a script which can accept input from either another command’s piped output or from the user’s input, a simple thing which i have honestly never employed before, because I considered it above and beyond my immediate needs.


Mark Grealish

Dashing brigand, handsome rapscallion, father, crazy cat lady and the world's greatest lover and liar, living in Dublin, Ireland.



Have your say on '/bin/bashing bit.ly'

Your email address will not be published. Required fields are marked *