Perl中的多个更新行

时间:2015-11-28 23:55:40

标签: perl command refresh lines backspace

我想要完成的输出是:

     line1 = get
     line2 = shwifty
     line3 = in
     line4 = here

...并在命令行中刷新所有这些字符串而不连续重新发布新行!如果只使用一行,我可以通过几种方式实现这个工作,但是如何在多行之后写入或退格?

现在,命令提示符将产生:

     line1 = get
     line2 = shwifty
     line3 = in
     line4 = here
     line1 = get2
     line2 = shwifty2
     line3 = in2
     line4 = here2

我怎样才能刷新"我想要的四条线?

1 个答案:

答案 0 :(得分:1)

对于多行,tput命令很有用。演示:

clear
for ((i=1; i<=4; i++)); do 
    tput cup 0 0
    printf "%s$i\n" get shwifty in here
    sleep 1
done