3 instantinstall speedtest-cli || exit 1
5 imenu -w "running speedtest, please wait" &
6 SPEEDOUT="$(speedtest-cli --simple)"
9 if [ -z "$SPEEDOUT" ]; then
10 echo 'running the speedtest failed
11 are you connected to the internet?' | imenu -M
16 PING="$(sed -n '1p' <<<"$SPEEDOUT" | grep -o '[0-9].*')"
17 DOWNLOAD="$(sed -n '2p' <<<"$SPEEDOUT" | grep -o '[0-9].*')"
18 UPLOAD="$(sed -n '3p' <<<"$SPEEDOUT" | grep -o '[0-9].*')"
20 [ -e ~/.cache/instantos/speedtest ] || touch ~/.cache/instantos/speedtest
21 sed -i "1i$(date '+%Y.%m.%d.%H.%M'):$PING:$DOWNLOAD:$UPLOAD" ~/.cache/instantos/speedtest
22 sed -i '400,$d' ~/.cache/instantos/speedtest
32 } | instantmenu -l 20 -c -h -1 -wm -w -1 -q 'speedtest'
35 [ -z "$CHOICE" ] && exit 1
37 if [ "$CHOICE" = "OK" ]; then
41 if grep -q 'ﴽ' <<<"$CHOICE"; then
43 elif grep -q '' <<<"$CHOICE"; then
45 elif grep -q '' <<<"$CHOICE"; then
47 elif grep -q '' <<<"$CHOICE"; then
53 [ -n "$COPIER" ] && echo "$COPIER" | xclip -selection c && notify-send "copied $COPIER to clipboard"