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:
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:
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
tweet "Check out this cool photo of my son: $(bitly //ix.bhalash.com/u/4144919/directions2.jpg)"
echo "Adorable photo of Garrett: $(bitly //ix.bhalash.com/u/4144919/directions2.jpg)" | mail -s "Cute, cute photo of Garrett!" firstname.lastname@example.org
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.