Monday, November 14, 2011

Link shortening by Curl

I'm a big fan of link shortening. Everywhere I want to share any interesting link with others I use short links. Other side I hate when anyone send me too long links.
There are many link shortening services exist. YouTube® for example use own shortening link service. For other resources I use only Google® service for this.
There are plugins for browsers to do that. 'Firefox' has plugin for it, 'Safari' has too. But any plugin can lead to security risk. That is why it it is not a good idea to use it.
As many knows I'm a terminal geek, so I'll show you how say to Google® what I want by terminal preinstalled program Curl. This magick program is very handy for many tasks.
This command send the string to Google® server and analize reply from it:
$ curl -s -d'&url=' | egrep -o '[^"]*'
I wrote a little bash script which could help automate the process. The screenshot of my script below. Have a good link shortening. :)

No comments: