Overwrite last line on terminal

后端 未结 6 974
耶瑟儿~
耶瑟儿~ 2020-12-23 02:21

My bash-script looks as following:

echo \"Description:\"
while [ $finishInput -eq 0 ]; do
read tmp
desc=\"$desc\"$\'\\n\'\"$tmp\"
if [ -z \"$tmp\" ]; then
fi         


        
6条回答
  •  被撕碎了的回忆
    2020-12-23 02:42

    In your example you delete the text at the same line. When you want to return to the previous line use \e[1A, and to clear that line, use \e[K:

    echo 'Old line'
    echo -e '\e[1A\e[Knew line'
    

    When you want to go N lines up, use \e[A

提交回复
热议问题