How to replace console output vertically in bash

I am using Bash (cygwin), and I would like to implement something like a progress indicator that spans vertical lines. It replaces the console output and does not append to it. It needs to look like an animation.

So this output appears over time:

Iteration 1:


Iteration 2:


Iteration 5:


The trick is to span vertical lines.

It is easy with echo if you do not span vertical lines. I can use \b to move backwards a space and overwrite previous characters:

echo -n -e "\b"

But how do you move up a line and overwrite previous lines.


You use ANSI escape-sequence to move the cursor:

\033[NA   - cursor up N lines
\033[NB   - cursor down N lines
\033[NC   - cursor right N steps
\033[ND   - cursor left N steps


$ echo -e '\033[8Chello'

Need Your Help

Service Stack response DTO with specific data inside JSON arrays

c# servicestack dto

I'm modeling my response DTOs for services which returns JSON data like this:

Testing Backbone Model with Jasmine and Sinon - Object #<Object> has no method 'spy'

testing backbone.js jasmine sinon

I am trying to learn how to use Jasmine and Sinon for testing a Backbone application, and I was following this tutorial. Nevertheless, I ran into a problem that I don't know how to solve.