A user is asking the systems administrator for assistance with writing a script to verify whether a file exists. Given the following: Which of the following commands should replace the <CONDITIONAL> string?
he command "if [ -f "$filename" ]; then" is a shell script that tests for the existence of a file named "$filename". The syntax of this command is as follows:
"if" is a shell construct that allows you to execute a command or a series of commands only if a certain condition is met.
"[ -f "$filename" ]" is a test command that returns true if "$filename" is a regular file (i.e., not a directory or a symbolic link). The "-f" option is used to test for the existence of a regular file. The "$filename" variable is enclosed in double quotes to allow for the possibility of spaces in the file name.
"then" is a keyword that specifies the start of the commands to be executed if the test is true.
Answer must be A -f file True if file exists and is a regular file THEN
upvoted 3 times
...
This section is not available anymore. Please use the main Exam Page.XK0-005 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Veteran903
Highly Voted 12 months agolinux_admin
Highly Voted 8 months, 4 weeks agoMrJ_
Most Recent 9 months ago