I am working on a program that sends a lot of output to stdout, but I want to be able to easily tell what the program is doing. I've seen some programs show the output of a script or program, yet the last line on the console is "reserved", meaning the output from the commands are shown on the screen, but the last line (or two, or however many) are reserved for a static or occasionally changing status text (e.g. Building <xxxxxx>...
). This way, one can see output from the script/program for debug/troubleshooting purposes, but also quickly glance over and see the status of the program. Is there any way to achieve this with a shell script? I don't mind using built-in system tools, such as awk
, to format the text, as long as the tools used are commonly found on most systems. If possible, I'd also like to avoid ncurses
and other libraries as well.
If you still don't understand what I'm saying, I'll try to illustrate it here:
make -gcc -NOFLAGS -someotherGibberishHere Component1afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component2afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component3afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component4afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component5afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component6afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component7afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component8afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component9afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component10afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component11afdjadfjfadkladfjk . . (etc.) . ------------------------------------------------------------------------ Installing component 11/134...
In this particular example, I'd like for the line "Installing component 11/134..." to remain there even once the console output starts to scroll. Preferably, I'd also like to keep that line right above it too.
That way, once we get into the thick of the program and normally the shell would've started scrolling, we'd still see:
. . (more lines of output here) . make -gcc -NOFLAGS -someotherGibberishHere Component58afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component59afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component60afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component61afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component62afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component63afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component64afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component65afdjadfjfadkladfjk make -gcc -NOFLAGS -someotherGibberishHere Component66afdjadfjfadkladfjk ------------------------------------------------------------------------ Installing component 66/134...
screen
ortmux
in split screen mode, and run two separate commands in each. – Cochard