-
-
Save gbl08ma/6115095 to your computer and use it in GitHub Desktop.
Unix shell script to shorten URLs with tny.im URL shortener. wget must be installed for this to work.
This file contains 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/sh | |
if [ -t 0 ]; then | |
if [ -z "$1" ]; then | |
echo "usage: tny long_url [custom_keyword]" | |
echo "" | |
echo "Shorten URLs with tny.im URL shortener" | |
echo "This script expects a long URL to shorten either as an argument or passed through STDIN." | |
echo "When using arguments, an optional second argument can be provided to customize the later part of the short URL (keyword)." | |
exit 1 | |
fi | |
url=$1; | |
else | |
while read -r line ; do | |
url=$line | |
done | |
fi | |
echo `wget -q -O - http://tny.im/yourls-api.php?action=shorturl\&format=simple\&url=$url\&keyword=$2` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi I added a little improvement (at least I think), check out my gist https://gist.github.com/schtibe/49e133c0a2a66d567bc0.
This line makes URLs like
https://ixquick-proxy.com/do/spg/show_picture.pl?l=english&rais=1&oiu=http%3A%2F%2Fwww.paperdroids.com%2Fwp-content%2Fuploads%2F2014%2F06%2Fsteve-rogers-i-understood-that-reference.jpg&sp=cad4415e0e97e028a2cc819394ceae14
work