#!/usr/pkg/bin/perl
$mbmon = `sudo mbmon -c 1`;
$mbmon =~ /^Temp\.= (.*);(.*)$/m;
$1 =~ /^(.*),\s+(.*),\s+(.*)$/m;
print "case:$1 cpu:$2";
-------------------------------------------
The script vil put out two tempatures. I only want the CPU tempature. Would someone help me to rewrite the script.
I'm currently getting this error when running /cmd.php
ERROR: expected 1 data source readings (got 2)
Rewrite small Perl script
Moderators: Developers, Moderators
I found out.
#!/usr/bin/perl
$mbmon = `mbmon -c 1`;
$mbmon =~ /^Temp\.= (.*);(.*)$/m;
$1 =~ /^(.*),\s+(.*),\s+(.*)$/m;
print "$2";
-----------------------------------------------
But then another question. The Perlscript then write out for example
39.5 degrees
How do I rewrite it to output the result without comma. For example
39
????
#!/usr/bin/perl
$mbmon = `mbmon -c 1`;
$mbmon =~ /^Temp\.= (.*);(.*)$/m;
$1 =~ /^(.*),\s+(.*),\s+(.*)$/m;
print "$2";
-----------------------------------------------
But then another question. The Perlscript then write out for example
39.5 degrees
How do I rewrite it to output the result without comma. For example
39
????
Re: Rewrite small Perl script
#!/usr/pkg/bin/perl
$mbmon = `sudo mbmon -c 1`;
$mbmon =~ /^Temp\.= (.*);(.*)$/m;
$1 =~ /^(.*),\s+(.*),\s+(.*)$/m;
print int($2);
$mbmon = `sudo mbmon -c 1`;
$mbmon =~ /^Temp\.= (.*);(.*)$/m;
$1 =~ /^(.*),\s+(.*),\s+(.*)$/m;
print int($2);
Who is online
Users browsing this forum: No registered users and 6 guests