echo cursor

Source

  • if we don’t want to print new lines in a loop, for example, we can print over the same line again simply by appending \r at the end of the string we print and use echo -ne:
while $(ps aux | grep app:update >/dev/null ); do echo -ne "$(date): Waiting...\r"; sleep 2; done; echo -e "$(date): Done!          "

will print the current date and time followed by : Waiting... and will be refreshed every 2 seconds
after it’s done, it’ll print the current time followed by : Done! (note the additional spaces, they’re needed to overwrite the Waiting... completely since this is a longer string than Done!)