需要使用T:R:G mod的Perl system()命令的进度指示器 [英] Need a progress indicator for a Perl system() command using T:R:G mod
本文介绍了需要使用T:R:G mod的Perl system()命令的进度指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个进度指示器,用于获取Perl的输出
I want a progress indicator that takes the output of a Perl
system('make')
,对于从make命令输出到STDOUT的每一行,我想输出一个点作为进度指示器.不幸的是,我正在使用Term :: ReadLine :: Gnu Perl mod.
and for each line output to STDOUT from the make command, I want to output a dot as a progress indicator. Unfortunately, I'm using the Term::ReadLine::Gnu Perl mod.
当make命令运行时,如何重定向STDOUT以捕获并计算行数?
How do I redirect STDOUT to capture and count the lines as the make command is running?
推荐答案
#!/usr/bin/perl
my $command = "make";
open (my $cmd, "$command |");
while(<$cmd>){
print ".";
}
print "\n";
这篇关于需要使用T:R:G mod的Perl system()命令的进度指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文