Issue
i want to rewrite first line but tput is removing all lines instead of first line
im testing this
cl=$(tput ed)
tput sc
echo 'line1____'
echo 'line2____'
echo 'line3____'
sleep 1
tput rc
echo "abc$cl"
echo ''
echo ''
sleep 1
when done it should look like
abc
line2____
line3____
but it is doing
abc
-empty
-empty
Solution
I think what you want is tput el
(clear to end of line) instead of tput ed
(clear to end of screen):
cl=$(tput el)
From the man pages for terminfo
:
Variable Cap- TCap Description
String name Code
clr_eol el ce clear to end of line (P)
^^ ^^^^^^^^^^^^^^^^^^^^
clr_eos ed cd clear to end of screen (P*)
^^ ^^^^^^^^^^^^^^^^^^^^^^
When I make this one change (cl=$(tput el)
) to your code it now generates:
abc
line2____
line3____
Answered By - markp-fuso Answer Checked By - Terry (WPSolving Volunteer)