Automation, Orchestration, and Scripting
A backup script must continue only when /var/backups exists and is a directory. If the path is a regular file or missing, the script must stop. Which test in an if statement meets this requirement?
Show the answer
Correct answerB. if [ -d /var/backups ]; then
The -d operator is true only when the path exists and is a directory. The -e operator is the tempting choice, but it is also true for regular files and other file types, so the script would continue when it should stop.