I have a shell script that calls a command (
sudo apt-get update). The current status is displayed in the terminal, but the older lines obviously move upwards. What I want to achieve is that the X recent lines are displayed and as a new line appears an old one is deleted. This means the output should always only occupy X lines.
I tried tail and sed but couldn't achieve the wanted result.