How to remove previous lines on bash?

I want to have a selector in a "case" menu, so I show the options:

   1) option A
   2) option B
   3) option C

Then read the choice (let's say it's B), remove the previous menu and show this instead:

   1) option A
 ยป 2) option B
   3) option C

How can I do this? I know we can remove the current line with echo -ne "\r", but I have no idea of how to do it with several

9 points · 2 comments · view on lemmy.world

2 Comments

smpl@discuss.tchncs.de · 2 pts · 2y (1 reply)
[ removed ]
smpl@discuss.tchncs.de · 1 pts · 2y
[ removed ]
adchevrier@lemmy.world · 1 pts · 2y (1 reply)

With 'clear'?

Moshpirit@lemmy.world · 1 pts · 2y

clear wipes the whole console, I prefer to keep the previous lines, and only remove some of them