CompTIA Linux+ (XK0-005) — Question 249
A Linux administrator would like to run the cleanup script /home/admin/script.sh at 9:00 p.m. on March 31. Which of the following commands should the administrator use to accomplish this task?
Answer options
- A. at –f /home/admin/script.sh 9pm March 31
- B. echo < /home/admin/script.sh | at 9pm March 31
- C. at 9pm March 31 | echo > /home/admin/script.sh
- D. at 9pm March 31 –f /home/admin/script.sh
Correct answer: A
Explanation
The correct command is option A, as it properly schedules the script with the 'at' command using the '-f' flag to specify the script file. Option B incorrectly uses 'echo' which does not directly execute the script, and option C attempts to use a pipe incorrectly. Option D has the correct command structure but is not the standard way to specify the file for the 'at' command.