Expand shortened URL's with GNU Wget

$ expand() { wget --server-response $1 2>&1 | grep "^Location"; }

$ expand shortened_url 

If the URL is shortened/directed more than once(ex. bit.ly/xyz to t.co/xyz), the process continues until the origin.