Question 1
What is the difference between the commands test -e path and test -f path?
Answer and explanation
Correct answer: A
The -e option tests for the existence of any path (file, directory, device, etc.), while the -f option specifically tests for the existence of a regular file. Option A correctly states that both check existence, but -f additionally confirms it is a regular file. Option B incorrectly claims -e tests for empty files (that would be -s for non-empty). Option C wrongly states -e tests for executable files (that would be -x). Option D is incorrect as they have different behaviors for directories and special files.