Courseiva
Automation, Orchestration, and ScriptingmediumMultiple ChoiceObjective-mapped

XK0-006 Automation, Orchestration, and Scripting Practice Question

A Bash script contains the following line: set -e. What is the effect of this command?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

It causes the script to exit if any command fails.

set -e causes the script to exit immediately if any command exits with a non-zero status. This is useful for catching errors early.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • It enables debugging by printing commands and their arguments as they are executed.

    Why it's wrong here

    That describes set -x, not set -e.

  • It prevents the script from overwriting existing files.

    Why it's wrong here

    There is no such built-in option.

  • It causes the script to exit if any command fails.

    Why this is correct

    Correct. set -e exits on error.

  • It treats unset variables as an error and exits.

    Why it's wrong here

    That is set -u.

About these practice questions

One of 979 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.