newbie syntax question

Roth, Gabrielle gabrielle.roth at xo.com
Tue Apr 10 11:59:50 CDT 2001


I'm maintaining a script written by my predecessor.

Here's the relevant snippet with line numbers:
    21  if (open (HINFO, "$snmpget '$router' '$community' '$oid' 2>/dev/null
|")) {
    22    while (<HINFO>)
    23      {
			<snip fun parsing stuff>
    31        }
    32      }
    33    close HINFO;
    34  } else {
    35    die "failed to run $snmpget";
    36  }
I have two questions, both regarding line 21:
1 - (probably more of a unix question) the redirection to /dev/null:  I know
this isn't the output of the command, because that's available via <INFO>
for the parsing loop.  So what is this for?  Is it dumping the exit status?
Is it necessary?  It works without it, but I'm wondering if it's some error
handling thing that I can't test and won't know if it's broken until it
breaks. :)
2 - what is the pipe for at the end of the command?  I've tried it without
this and I get this error:
failed to run /usr/bin/snmpget at ./mrtg-cpustate line 35.

Thanks for any pointers/insight!

-gr 
TIMTOWTDI



More information about the Pdx-pm-list mailing list