[mrtg] Re: script problem
Alex van den Bogaerdt
alex at slot.hollandcasino.nl
Sun Feb 20 08:46:12 MET 2000
Justin Shore wrote:
>
>
> Alex,
> Thanks for the reply. Unfortunately its still not working.
> Here's where I'm at now:
>
> [...]
>
> Its still printing that out error out to the screen when I run it by
> hand on a port that I know doesn't exist. I'm not great at stderr
> and all that. Is there a way to trap it?
Take the example again, this time we trow away stdout:
[alex at home]$ snmpget router public 4.21.1.2.10.2.2.2 > /dev/null
If I do so, I end up with nothing (probably an older snmpget :-)
If you do get an error on screen using this line, it should come via stderr.
You can reroute this to stdout (you're using bash, aren't you?):
[alex at home]$ snmpget router public 4.21.1.2.10.2.2.2 2>&1
With this addition, stderr is routed to stdout and now you can use the
rest of the script (provided you can distinguish the output).
Another way to go would be checking the result code of the command, you
can query the "$?" variable for that.
This is not a linux or unix list so I should not talk to much about
it here.
regards,
--
__________________________________________________________________
/ alex at slot.hollandcasino.nl alex at ergens.op.het.net \
| work private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:mrtg-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/mrtg
More information about the mrtg
mailing list