Overwrite last line on terminal

后端 未结 6 952
耶瑟儿~
耶瑟儿~ 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

    If you want to run a script in a loop and not blow up your scrollback, you can use the following pattern:

    while sleep 10s; do 
      echo -n $(script)
      echo -n -e "\e[0K\r"
    done
    

    Just replace the script command with your own.

提交回复
热议问题