in reply to Parsing 'uptime' output
Here's one way:
my @uptime = split " ", qx(/usr/bin/uptime); my %uptime; @uptime{'Time', 'Uptime', 'Current Users', 'CPU Load'} = ( $uptime[0], join ' ', @uptime[1..4], join ' ', @uptime[5..6], join ' ', @uptime[7..$#uptime] );
Update: Repaired typo, ++sauoq for the eyes. There seems to be a problem with the parsing...fixed, not pretty, but neither is uptime :-\
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Uptime
by sauoq (Abbot) on Aug 18, 2002 at 22:03 UTC |