How to display and refresh multiple lines in bash

后端 未结 5 802
孤独总比滥情好
孤独总比滥情好 2020-12-14 21:49

I am writing a installation script and would like to display the status of the script as it progresses.

example:

var1=\"pending\"
var2=\"pending\"
va         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 22:06

    This code should give you the idea:

    while :; do
        echo "$RANDOM"
        echo "$RANDOM"
        echo "$RANDOM"
        sleep 0.2
        tput cuu1 # move cursor up by one line
        tput el # clear the line
        tput cuu1
        tput el
        tput cuu1
        tput el
    done
    

    Use man tput for more info. To see the list of capabilities use man terminfo

提交回复
热议问题