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 | |
| ### takes long uri from clipboard, then saves the shortened uri back to the clipboard | |
| ### requires pbpaste/pbbiycopy (os x) and a legacy bitly api key | |
| longURI=`pbpaste` | |
| apikey=your_api_key_here | |
| username=your_user_name_here | |
| format=txt | |
| encodedURI="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$longURI")" | |
| curl -s "https://api-ssl.bitly.com/v3/shorten?login=$username&apikey=$apikey&longUrl=$encodedURI&format=$format" | pbcopy |
NewerOlder