if ls /etc/passwd /dev/null
then
echo exists
fi
A. The redirect to /dev/null will silence the return code invalidating the conditional.
B. The ls command will output the name of the file to the screen.
C. The if conditional has test conditions for the existence of a file that are far more reliable.
D. This is a valid way of checking for the existence of a file.
No comments:
Post a Comment