title: Bash scripting linux: Lay-out and output of a script
body: <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>24/11/2016 12:01 ********** 5.2MB/s 
  24/11/2016 12:03 *******    3.5MB/s 
  24/11/2016 12:05 ********   3.9MB/s
  </code></pre>
  
  <p>i'm using speedtest-cli -simple, this command reveals my download and upload speed.</p>
  
  <p>Now this is my first script :</p>
  
  <pre><code> while true; do 
       date “´%x %X” &gt;&gt; Test.txt 
       speedtest-cli –simple &gt;Speedtest.txt 
       sed '2!d' speedtest.txt &gt;&gt; Test.txt 
       rm Speedtest.txt 
       sleep 20 
   done
  </code></pre>
  
  <p>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")</p>
  
  <p>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.</p>