Originally Posted by pan64
I still do not understand it. The code in post #6 will not count the "up"s, but will try to start vpn ten times (if "up" was not found). And also at the tenth try it will finish the for loop and report "VPNbook NOT restablished " without checking the result.
Correct me if I'm wrong, but this is NOT about finding the word "up" ten times in a file. This is about trying to find the word "up" in a log once, but with 10 as the break limit otherwise it would be an infinite loop.
For this purpose the above scripts, except for the first/OP work fine.