Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

LPI 102-500 Exam - Topic 11 Question 118 Discussion

Actual exam question for LPI's 102-500 exam
Question #: 118
Topic #: 11
[All 102-500 Questions]

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

Show Suggested Answer Hide Answer
Suggested Answer: C

The test command is used to perform checks and comparisons on files and values. The -e option tests if a given path exists, regardless of its type (file, directory, link, etc.). The -f option tests if a given path exists and is a regular file, not a directory or a special file. For example, if we have a directory named dir and a file named file, we can use the test command as follows:

test -e dir && echo ''dir exists'' dir exists test -f dir && echo ''dir is a regular file'' (no output) test -e file && echo ''file exists'' file exists test -f file && echo ''file is a regular file'' file is a regular file


https://www.computerhope.com/unix/bash/test.htm

Contribute your Thoughts:

0/2000 characters

Currently there are no comments in this discussion, be the first to comment!


Save Cancel