nerdexam
LPI

102-400 · Question #84

What is the difference between the commands test -e path and test -f path?

The correct answer is C. Both options check the existence of the path. The -f option also confirms that it is a regular file. See the full explanation below for the reasoning.

Question

What is the difference between the commands test -e path and test -f path?

Options

  • AThey are equivalent options with the same behaviour.
  • BThe -f option tests for a regular file. The -e option tests for an empty file.
  • CBoth options check the existence of the path. The -f option also confirms that it is a regular file.
  • DThe -f option tests for a regular file. The -e option tests for an executable file.

How the community answered

(38 responses)
  • A
    5% (2)
  • B
    11% (4)
  • C
    84% (32)

Community Discussion

No community discussion yet for this question.

Full 102-400 Practice