如何在Perl命令行应用程序上更新进度显示? [英] How can I update a progress display on a Perl command-line application?

查看:131
本文介绍了如何在Perl命令行应用程序上更新进度显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Perl脚本(在Windows上),它检查一些文件,以帮助我的日常业务。现在它打印出像... ...

I have a little Perl script (On Windows) that checks some files for me as an aid to my day-to-day business. At the moment it prints out something like...

0%
25%
50%
75%
Complete

但我记得我在过去,它没有逐行打印进度,但更新了显示器上的输出,可能是通过将光标移回并过度打印那里的内容。

But I can remember scripts I've used in the past that didn't print progress on a line-by-line basis, but which updated the output on the display, presumably by moving the cursor back and over-printing what was there.

任何人都知道需要什么魔法?

Anyone know what magic is required? Portability isn't important to me, the script is quite disposable.

推荐答案

除了其他答案,\r将返回到当前行的开头

In addition to the other answers, \r will go back to the beginning of the current line

这篇关于如何在Perl命令行应用程序上更新进度显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆