Skip to content

Instantly share code, notes, and snippets.

@alanmquach
Created February 16, 2015 23:27
Show Gist options
  • Save alanmquach/e39841ccf5d4f640afc5 to your computer and use it in GitHub Desktop.
Save alanmquach/e39841ccf5d4f640afc5 to your computer and use it in GitHub Desktop.
Breakdown the times of a redirect chain by redirect
NEXTURL="http://bit.ly"
while [ -n "$NEXTURL" ]; do
RESP=$(curl -o /dev/null -s -w "%{time_total},%{redirect_url}" $NEXTURL);
THISTIME=`echo -n "${RESP}" | cut -f 1 -d ","`;
echo -ne "${THISTIME} : ${NEXTURL} \n";
NEXTURL=`echo -n "${RESP}" | cut -f 2 -d ","`;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment