I have a watchdog implemented in bash that is restarting a service on certain conditions and it does move the old logs to an old directory.
The problem is that I do want to move the logs to old_1, old_2, … if previous one exists.
How can I implement this in bash?
You can search for the first non-existing log like this: