Skip to content

Instantly share code, notes, and snippets.

@jab416171
Last active August 29, 2015 14:05
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 jab416171/de1b6d2050a3e926f378 to your computer and use it in GitHub Desktop.
Save jab416171/de1b6d2050a3e926f378 to your computer and use it in GitHub Desktop.
#!/bin/sh
filename=/tmp/speedtest_results
result=$(speedtest --simple)
download=$(echo $result | grep -oP "(?<=Download: )[0-9\.]* .*?/s")
upload=$(echo $result | grep -oP "(?<=Upload: )[0-9\.]* .*?/s")
ping=$(echo $result | grep -oP "(?<=Ping: )[0-9\.]* .*?ms")
if [ ! -e $filename ]; then
echo "\"Date\",\"Upload\",\"Download\",\"Ping\"" > $filename
fi
echo "\"$(date)\",\"$upload\",\"$download\",\"$ping\"" >> $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment