Skip to content

Instantly share code, notes, and snippets.

@adamstrawson
Last active December 28, 2015 10:39
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 adamstrawson/7488317 to your computer and use it in GitHub Desktop.
Save adamstrawson/7488317 to your computer and use it in GitHub Desktop.
Simple bash script to get HTTP response times
#!/bin/bash
CURL="/usr/bin/curl"
echo -n "Enter Url to test: "
read url
URL="$url"
result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
IFS=':' read -a times <<< "${result}"
echo "Results: $URL"
echo "------------------------------------------------"
echo "| Connect Time | Transfer Start Time | Total |"
echo "------------------------------------------------"
echo "| ${times[0]}ms | ${times[1]}ms | ${times[2]}ms |"
echo "------------------------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment