- or download this
top -bcS -n 1
-b batch mode (non-interactive)
-n <num> iteration count
-S cumulative CPU for dead children
-c display full command line
- or download this
lll.pl:
sub longestLineLength {
my $longestLen = undef;
...
$ ./test-01.pl
80
- or download this
$ COLUMNS=1000 ./test-01.pl
552
- or download this
open (TOP, "COLUMNS=1000 /usr/bin/top -bcS -n 1 |")
OR
open (TOP, "/usr/bin/env -i COLUMNS=1000 /usr/bin/top -bcS -n 1 |"
+)
- or download this
$ ./test-02.pl
552
- or download this
$ ./test-02.pl 2>err
81
- or download this
test-03.pl:
open (TOP, "/usr/bin/env -i COLUMNS=1000 /usr/bin/top -bcS -n 1 2>
+err.txt |")
$ ./test-03.pl
81
- or download this
#!/usr/bin/perl
require "lll.pl";
...
$ ./test-04.pl output
$ cat output
81
- or download this
$ perl -v
This is perl, v5.6.1 built for i386-linux
...
$ uname -a
Linux ahost 2.4.9-e.40enterprise #1 SMP Thu Apr 8 16:43:01 EDT 2004 i6
+86 unknown
(actually it's RedHat Enterprise Linux 2.1, w/ recent patches)