[lug] Bash Scripting Ping

D. Stimits stimits at comcast.net
Sun Nov 8 10:53:09 MST 2020


I am curious about something in bash scripting which does not seem to be particularly easy. I wanted to script "ping -O -D address" such that each line gets processed by some logic if the ping fails. Redirecting ping to a variable does not work because it only "returns" when the ping exits (each line is not an exit). Even if I were to fork and exec, the forked process would itself have the same problem.

Is there some simple/clever way to process each line of a ping in bash without killing off the ping itself? My goal was to send it through some database and statistics type processing as success/failure lines occur.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20201108/6cbec4e2/attachment.html>


More information about the LUG mailing list