This seems close:
#!/bin/bash
ping -D -i 0.1 1.1.1.1 | while read ping_line
do
if [ -z $(read -t 0.01) ]; then
echo $last_line
sleep 1
fi
last_line=$ping_line
done
So the idea there is to keep reading until read times out, and then the last read should be the latest sample. This isn't quite behaving as expected, but I wonder if this might work?
But I still favour the fifo based approach if that can be made to work.
If anyone has any ideas please chime in!
In the meantime, here is for hoping: