I'm writing a shell script to help stabilize my unstable connection. The script pings my router n times (given in a config file) and returns a message based on whether it was successful or not. The problem however, is that I would like to print out a message for example every 100th package ping has sent. But is this possible? I could create a loop, that would lopp n times, and then print out a message based on that, but then I would have to restart ping n times too, which will use a lot more resources than calling ping only once.

Am I looking at something that's not possible? Help and ideas appreciated.