Created
November 27, 2015 16:00
-
-
Save magamig/ba058a0ff02928d8ebaf to your computer and use it in GitHub Desktop.
Script to shorten URLs (through bit.ly) (from: http://www.aproposmac.com/2011/06/shorten-url-on-bitly-using-curl.html and j.erik comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Change 'YOURLOGIN' and 'YOURAPIKEY' before using! | |
# | |
# Instructions: | |
# 1. Copy the url you wish to shorten to the clipboard. | |
# 2. Run the script, the shorten url will be in your | |
# clipboard now and all you have to do is paste it | |
# where you want it. | |
# | |
url=$(pbpaste) | |
curl -s "http://api.bitly.com/v3/shorten?login=YOURLOGIN&apiKey=YOURAPIKEY&longUrl=$url&format=txt" | pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment