On Sun, 2003-07-27 at 06:08, Jan Wilson wrote:
> * Gavin <[EMAIL PROTECTED]> [030727 06:30]:
> > I'm trying to run this script I got out of "O'reilly's LINUX SERVER HACKS"
> [snip]
> > I copied it line for line, and when I tried to run it I got the message:
> > 
> > Bareword "LOAD" not allowed while "strict subs" in use at ./tl line 11.
> > Execution of ./tl aborted due to compilation errors.
> 
> Not sure why it didn't work, except that `/bin/hostname` needs to be
> in backticks, not single quotes.  This works for me on the command
> line:
> 

yeah, I'd assume a typo at line 9 or line 11, something like a missing
quote or semicolon.

> #!/usr/bin/perl -w
> use strict;
> $|++;
> 
> my $host=`/bin/hostname`;
> chomp $host;
> 
> while(1) {
>     open(LOAD,"/proc/loadavg")
>         || die "couldn't open /proc/loadavg: $!\n";
>     my @load=split(/ /,<LOAD>);
>     close(LOAD);
>     # print "\033]0;";
>     print "$host: $load[0] $load[1] $load[2] at ",
>       scalar(localtime), "\n";
>     # print "\007";
>     sleep 2;
> }
> 
> I commented out the lines with the octal print codes and added a
> newline for each line.  I don't have that book so I don't know what it
> is really supposed to do, but I hope this helps.

just prints hostname, load average, and time every two seconds. The
octals are unfamiliar to me too -- I was assuming color codes, but when
I ran it with them in it didn't produce any text to STDOUT, just a
series of newlines. A little Googling shows that they are intended to be
color codes, must not be interacting nicely with aterm though.
-- 
Jack Coates
Monkeynoodle: A Scientific Venture...


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to