Pull info from a ping

Hi I am new to the BBB and Linux. I am trying to ping a device and pull the round trip time and make an LED come on if it is within a certain time.

For instance if the ping is less than 20ms I want a green light and if it is more than I want a yellow light, if it fails I want a red light. I have used an LED no problem, however I am at a loss for how to extract the ping time.

Is there any command out there that can do this for me?

Thanks!

You are going to have to ping the device with either “ping” or “L2Ping” for Bluetooth and then parse the result.

A typical linux way to to do this would be to pipe the output of ping into something like sed or awk, read field 7 (as separated by whitespace) then read the value immediately after the “=”. If you look up sed you should find examples.