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

apache - setting document root in antoher partition on ubuntu -

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

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -