I want to write a bash script in linux that reveals the download speed of my internet at a certain date time + day followed by the downloading speed.
The information must be stored into a file on the same line, I want a second script to reveal the speed in a sort of "graphic" like seen below:
24/11/2016 12:01 ********** 5.2MB/s
24/11/2016 12:03 ******* 3.5MB/s
24/11/2016 12:05 ******** 3.9MB/s
i'm using speedtest-cli -simple, this command reveals my download and upload speed.
Now this is my first script :
while true; do
date “´%x %X” >> Test.txt
speedtest-cli –simple >Speedtest.txt
sed '2!d' speedtest.txt >> Test.txt
rm Speedtest.txt
sleep 20
done
For now i want it to run until I decide to stop the script. But my problem is that the date and the download speed doesn't get stored on the same line. (also I can't figure out to just output the download speed so i use sed'2!d' to delete al exept the download line output and put it in the main file, though it wil be displayed like "download : 2.1MB/s")
The date display is correct and the graphic where problems for later but I wonder how to put the output of the commands next to each other, if i know that i will find a way to display date followed by the graphic and the download speed on the same line.