forked from matryer/xbar-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbandwidth-test-min.2h.sh
executable file
·31 lines (28 loc) · 1.08 KB
/
bandwidth-test-min.2h.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# Bandwith test, using speedtest-cli (https://github.com/sivel/speedtest-cli)
# Mini version!
#
# <xbar.title>Bandwith test (minified)</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.author>Jonny Lin</xbar.author>
# <xbar.author.github>rangedsp</xbar.author.github>
# <xbar.desc>Modified mini version of Alexandre Espinosa Menor's Bandwith tester, which uses https://speedtest.net via speedtest-cli</xbar.desc>
# <xbar.dependencies>speedtest-cli</xbar.dependencies>
# <xbar.image>http://i.imgur.com/mrPw9MV.png</xbar.image>
#
# Dependencies:
# speedtest-cli (https://github.com/sivel/speedtest-cli)
# modify this path according your prefs
if command -v "/usr/local/bin/speedtest-cli" >/dev/null 2>&1; then
OUTPUT=$(/usr/local/bin/speedtest-cli --simple)
else
OUTPUT=$(~/bin/speedtest-cli --simple)
fi
result_string="${OUTPUT/Ping: /P:}"
result_string="${result_string/Download: /D:}"
result_string="${result_string/Upload: /U:}"
result_string="${result_string/ Mbit/Mb}"
result_string="${result_string/ Mbit/Mb}"
result_string="${result_string/ ms/ms}"
echo "$result_string"