#!/usr/bin/perl use strict; use warnings; open(STAT, '-|', 'vmstat 2') or die "Could not open pipe: $!"; my $count; # not necessary, just for demonstration while (<STAT>){ last if $count++ > 5; # we don't want more than 5 lines of out +put print $_, "\n"; } print "...done\n";
In reply to Re: termination of system command
by svenXY
in thread termination of system command
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |