Here is a simple bash script that shortens a long URL using tny.im (https://tny.im). It can also shorten email, Bitcoin, Dogecoin, Litecoin addresses.
#!/bin/sh
if [ -t 0 ]; then
if [ -z "$1" ]; then
echo ""
echo "Shortens url with tny.im url shortener."
echo ""
echo "It shortens email & Bitcoin-Dogecoin-Litecoin addresses too."
echo ""
echo "Usage: tny long_url_address keyword"
echo ""
echo "Second argument 'keyword' is optional. Use it to customize the short url."
echo ""
exit 1
fi
url=$1;
else
while read -r line; do
url=$line
done
fi
printf "%s" "Short url -> " && echo `wget -q -O - http://tny.im/yourls-api.php?action=shorturl\&format=simple\&url="$url"\&keyword="$2"`
Save this script some where in your path with the name 'tny' and give it 'Execute' permission. Next time you want to shorten a long URL, simply run 'tny' from your terminal.
More info can be found here,
tny (https://github.com/hakerdefo/tny)
Cheers!!!
You are full of surprises and great gifts mate!
Thank you hakerdefo!