bash - Updating last 2 lines displayed on terminal using shell? -


i'm trying build simple progress bar script display bar current action in progress.

with of echo -ne "[||...] processing ${file_name}\r" can display progress bar as:

[||||||||............] processing file1

however i'm expecting output this:

processing file1

[||||||||............]

note: both seperate lines , want update them both script progress.

is there way achieve this?

you can use tput cuu 2 move cursor 2 lines, , tput el clear current line:

while sleep 1     tput el; date     tput el; echo "$random"     tput cuu 2 done 

this produce 2 changing lines of e.g.

thu jul 23 17:50:46 pdt 2015 23676   

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -