An IT technician is creating a shell script to clean up outdated log files automatically. Arrange the following scripting statements and constructs in the correct logical execution sequence from first to last.
- 1Initialize environment variables for the log directory path and maximum file age limit.
- 2Evaluate a conditional statement (IF/THEN) to verify that the target log directory exists.
- 3Execute a loop construct (FOR/FOREACH) to iterate through all log files matching the target age criteria.
- 4Print a completion status message to the console and exit the script.
Cevap
The correct logical order begins with defining environment variables, followed by evaluating a conditional statement for directory existence, running a loop construct to iterate through old files, and finally outputting a completion message.
Structured script execution follows a mandatory logic sequence: variable declaration sets up parameters, conditional statements validate execution requirements, repetition loops perform automated tasks over target sets, and output logging summarizes results.
Adım Adım Çözüm
Anahtar Kavram
Script Execution Logic and Control Constructs