Skip to content

Instantly share code, notes, and snippets.

@LucaTNT
Created March 2, 2016 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LucaTNT/204febfe6bb901c792fa to your computer and use it in GitHub Desktop.
Save LucaTNT/204febfe6bb901c792fa to your computer and use it in GitHub Desktop.
A script that appends to a CSV file the results of your internet speed test (via speediest-cli)
#!/bin/bash
OUTPUT="`speedtest-cli --simple`"
PING=`echo "$OUTPUT" | grep Ping | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
DOWNLOAD=`echo "$OUTPUT" | grep Download | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
UPLOAD=`echo "$OUTPUT" | grep Upload | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
DATE=`date +%Y/%m/%d`
TIME=`date +%H:%M:%S`
echo "$DATE;$TIME;$PING;$DOWNLOAD;$UPLOAD" | tee -a /var/log/speedtest.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment