bash script, erase previous line?

前端 未结 6 1270
暗喜
暗喜 2021-01-31 10:31

In lots of Linux programs, like curl, wget, and anything with a progress meter, they have the bottom line constantly update, every certain amount of time. How do I do that in a

6条回答
  •  不思量自难忘°
    2021-01-31 11:16

    You can also use tput cuu1;tput el (or printf '\e[A\e[K') to move the cursor up one line and erase the line:

    for i in {1..100};do echo $i;sleep 1;tput cuu1;tput el;done
    

提交回复
热议问题