Skip to content

Instantly share code, notes, and snippets.

@dgmltn
Created October 29, 2014 20:58
Show Gist options
  • Save dgmltn/792333d1c9e16f41aa25 to your computer and use it in GitHub Desktop.
Save dgmltn/792333d1c9e16f41aa25 to your computer and use it in GitHub Desktop.
Speed test shell script (using curl or wget)
#!/bin/sh
FILE_URL=http://speedtest.wdc01.softlayer.com/downloads/test10.zip
if [ -e /usr/bin/curl ] && [ -e /usr/bin/bc ] && [ -e /usr/bin/xargs ]; then
echo "scale=2; `curl --progress-bar -w "%{speed_download}" $FILE_URL -o /dev/null` / 131072"\
| bc\
| xargs -I {} echo {} mbps
elif [ -e /usr/bin/curl ]; then
curl -o /dev/null $FILE_URL
elif [ -e /usr/bin/wget ]; then
wget --output-document=/dev/null $FILE_URL
else
echo "Neither wget nor curl commands found"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment