Skip to content

Instantly share code, notes, and snippets.

@dsc
Created March 15, 2010 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsc/333119 to your computer and use it in GitHub Desktop.
Save dsc/333119 to your computer and use it in GitHub Desktop.
unshorten.sh -- undo tiny-ing, bitly-ing, shady-ing, etc
#!/bin/bash
# usage:
# unshorten.sh 'http://bit.ly/95U1UY'
# echo 'http://bit.ly/95U1UY' | unshorten.sh
#
# author: dsc@less.ly
if test "$1"; then
url="$1"
else
read url
fi
curl -I -s "$url" | fgrep 'Location:' | cut -d ' ' -f 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment