3 ms·
I've been using my "dots" script for over 10 years to give me feedback that a long task (like un-tarring a big source tree) is still running, without flooding t
by jdblair 7y ago
I've been using my "dots" script for over 10 years to give me feedback that a long task (like un-tarring a big source tree) is still running, without flooding the terminal with text. I pipe the "verbose" output of a command into the script: tar xvfz kernel.tar.gz | dots
#!/usr/bin/perl
$| = 1;
$i = 0;
if ($#ARGV < 0) {
$number = 1000;
} else {
$number = shift(@ARGV);
}
while (<STDIN>) {
print '.' unless ($i % $number);
$i++;
}
print "\n";
- wruza 7y agoSee also pv. https://linux.die.net/man/1/pv https://linux.die.net/man/1/pv
- isp 7y agotl;dr - The flag for pv in this case is --line-mode (-l). So, if you have a command that produces lots of lines of output (e.g., for demo purposes, "yes" - which literally floods the terminal with lines): yes | pv -l >/dev/null Example progress output, showing lines processed (total & rate): 405M 0:00:03 [ 140M/s] [ <=> ]