this post was submitted on 28 Aug 2023
9 points (100.0% liked)
Bash
720 readers
7 users here now
Talk about the Bash Shell and Bash scripting
founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
It doesn't look to me like you want to remove lines. It looks like you want to move the cursor to a position and write a character.
You would probably want to move up two rows to column one and print the marker like this
\E[2F»
. If you want to delete option B and C and write them again it'll be something like thisecho -e "\E[2F\E[2K» 2) option B\n\E[2K 3) option C"
.See more in
man console_codes
Also see the
tput
andterminfo
manpages. You find the capabilities in terminfo and you use them with tput, like fx. moving the cursor to row 10 column 10 withtput cup 10 10
, where cup is described in the terminfo manpage.You can save and restore the cursor too with
s
andu
, so that your example could be done from an interactive terminal like this.