Skip to content

Instantly share code, notes, and snippets.

Forked from gbl08ma/tny
Last active February 20, 2023 12:57
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Unix shell script to shorten URLs with URL shortener. wget must be installed for this to work.
if [ -t 0 ]; then
if [ -z "$1" ]; then
echo "usage: tny long_url [custom_keyword]"
echo ""
echo "Shorten URLs with 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
url=$(python -c "import urllib.parse; print(urllib.parse.quote_plus('$1'))");
while read -r line ; do
echo `wget -q -O -\&format=simple\&url=$url\&keyword=$2`
Copy link

OrionRandD commented Feb 18, 2023

I was using this code, but seems it is not working anymore...
Does it still work?
I've tried with this url

Copy link

schtibe commented Feb 20, 2023

Hey. What do you mean exactly with "it doesn't work"?

Copy link

OrionRandD commented Feb 20, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment