I want to print only the last line of the output of a command on the same line continuously without clearing the screen. This would be part of another function. Let's say my script has the following pseudo code:
test_project_local_install(){
install_project
setup_venv
run_tests
}
I would want a command to use in the following way:
test_project_local_install(){
printf "Install Project: "
install_project | magic_command
printf "Setup Venv: "
setup_venv | magic_command
printf "Run Tests: "
run_tests | magic_command
}
So that the test_project_local_install
command output is the following:
$ > test_project_local_install
$ Install Project: install_project updated output on one line
$ Setup Venv: setup_venv updated output on one line
$ Run Tests: run_tests updated output on one line
The accepted solution to this question does what I want in terms of outputting only last lines of a command continuously but it also clears the screen which is not what I want. I could not figure out a way to adapt the code. Other suggested answers don't match what I'm looking for either. Thanks !