#!/bin/sh
# Follow the provided short URL and show each location redirect in the
# chain. Usage: follow http://short.url/12345
HOP=$1
while [ -n "$HOP" ]
do
printf "%s\n" "$HOP"
HOP=$( curl -Is "$HOP" | dos2unix | sed -n 's/^[Ll]ocation: //p' )
done