I don’t know if this was happening before I suggested improvements, but grep is buffering more than a single line and doesn’t output til the end. This made it much more real time:
for ttl in {1..30}; do ping -4 -c 1 -t $ttl example.com && break; done | grep --line-buffered -i from | nl -s ' ' -w 2
Hey, I’d add an
&& break
to make it stop once a success is reached:Thanks! This makes the output much neater. I have updated this command in my post to include the
&& break
now.I don’t know if this was happening before I suggested improvements, but grep is buffering more than a single line and doesn’t output til the end. This made it much more real time:
(https://unix.stackexchange.com/a/293289)