Question 240
A disposable test directory and all of its contents must be removed after reviewing the path. One student proposes Run rm -r -- test-output/ and another proposes Run mkdir -p a/b/c. Which technical comparison is the soundest?
Explanation
Correct Answer
Correct distinction: Run rm -r -- test-output/ targets delete directory tree carefully; The -r option descends recursively; the -- delimiter prevents names beginning with - from becoming options. The compared alternative instead serves create nested directories.
Incorrect Answers
Incorrect mapping: Run mkdir -p a/b/c is used for create nested directories. It does not displace Run rm -r -- test-output/ for the described requirement.
The mechanisms are different: The -r option descends recursively; the -- delimiter prevents names beginning with - from becoming options. By contrast, The -p option creates missing parent directories along the path. They are not universally interchangeable.
The third option addresses copy while keeping source: cp copies file contents while retaining the original source file. The original action remains relevant because The -r option descends recursively; the -- delimiter prevents names beginning with - from becoming options.