1. 9
  1. 2

    Hey, I’d add an && break to make it stop once a success is reached:

    for ttl in {1..30}; do ping -4 -c 1 -t $ttl example.com && break; done | grep -i from | nl -s ' ' -w 2
    
    1. 2

      Thanks! This makes the output much neater. I have updated this command in my post to include the && break now.

      1. 4

        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
        

        (https://unix.stackexchange.com/a/293289)