title: bash printing lines to STDOUT and deleting them
body: <p>I have an interactive script that I want to print some lines, overwrite them with blank lines and write some more:</p>
  
  <pre><code>    for host in "${!HOSTS[@]}"
      do
              echo "Running on ${HOSTS[$host]}:"
              ssh ${HOSTS[host]} "echo blah ; echo blah"
              echo -e "\e[4A"
              printf " %$((COLUMNS-1)).s\n" {1..3}
              echo -e "\e[4A"
      done
  </code></pre>
  
  <p>This is based that I will actually have 3 lines of previous output.</p>
  
  <p>Is there a way to make it more dynamic? Finding out how many lines were printed and overwriting exactly those?</p>
  
  <p>Thanks</p>