Question: Write bash script that rotate logs. Do the following: - create a log directory. The directory is an argument to routate the file names -
Write bash script that rotate logs.
Do the following:
- create a log directory. The directory is an argument to routate the file names
- file names in the format .number.log
- if NOT vaild - input parameters such as no inputs, negative number, not a directory and non writable directory. Provide feedback to the user and end the program
- if IS VAILD - Rename all files with name (e.g. -3 will rename all files to .3.log). Delete all files with number higher than 5
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
