Skip to content

Instantly share code, notes, and snippets.

@AndyObtiva
Created February 24, 2014 05:19
Show Gist options
  • Save AndyObtiva/9182347 to your computer and use it in GitHub Desktop.
Save AndyObtiva/9182347 to your computer and use it in GitHub Desktop.
Speedtest Command for Bash. Assumes you have https://pypi.python.org/pypi/speedtest-cli installed.
#!/bin/sh
echo "Usage: speedtest [city]"
echo "Default city: Montreal"
echo "Examples:"
echo "$ speedtest Chicago"
echo "$ speedtest 'New York'\n"
[[ $1 ]] && city="$1" || city='Montreal'
echo "Speedtesting $city... Please be patient as this may take a minute or more depending on the Internet connection..."
speedtest-cli --list | grep -i "$city" | sed 's/^\([^\)]*\).*$/\1/' | sed -n '1,1p' | xargs speedtest-cli --share --server | grep 'Share results:' | grep 'Share results:' | sed 's/^Share results: \(.*\)$/\1/' | xargs open
echo "Done. If no report image has been opened, then please try again with another city."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment