How can I rename a log or error file to prevent overwriting?
I have a bash script that produces an output log file.
When re-running the script I want the old log files to be preserved by changing the name of the every logfile depending on the name of the last file created.
For example:
1st run: script.sh > log.file produces log.file1
2nd run: script.sh > log.file produces log.file2
3rd run: script.sh > log.file produces log.file3
Basically every run needs to check the last log file and count one up.