Suppress output from ping in script?
Posted: Wed Jul 30, 2014 7:02 pm
Is there a way to suppress the output from the ping command in a script? I am on 6.x - running 6.15
Essentially, I only want the return value from the command - number of successful pings - without the ping command printing to the console.
Right now this produces:
Essentially, I only want the return value from the command - number of successful pings - without the ping command printing to the console.
Code: Select all
:local addr 192.168.100.2
:local pingInt "50ms"
:local pingCount 5
:if ([/ping address=$addr interval=$pingInt count=$pingCount] = 0) do={
:put ("Ping: FAILED")
} else={
:put ("Ping: OK")
}
What I want is this:/system script run test
HOST SIZE TTL TIME STATUS
192.168.100.2 56 64 0ms
192.168.100.2 56 64 0ms
192.168.100.2 56 64 0ms
192.168.100.2 56 64 0ms
192.168.100.2 56 64 0ms
sent=5 received=5 packet-loss=0% min-rtt=0ms avg-rtt=0ms max-rtt=0ms
HOST SIZE TTL TIME STATUS
Ping: OK
Actually, there seems to be a bug in the output of ping - does not switch off bold face. My put command prints in bold face./system script run test
Ping: OK