Courseiva

LPIC-1 Shells, Scripting and Data Management Practice Question

A user wants to set a shell variable named DEPLOY_ENV to the value 'staging' in the current Bash session so that child processes can read it. Which command accomplishes this?

⚠ Common exam trap

Watch out — candidates often confuse a shell variable with an environment variable and assuming that any assignment automatically makes the value available to child processes.

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

✓

export DEPLOY_ENV=staging

To make a variable available to child processes, it must be exported into the environment. The export builtin, used together with an assignment, both sets the variable in the current shell and ensures it is inherited by subsequently launched commands. A plain assignment stays local to the shell, set controls shell options, and env without a command only displays the environment.

Answer analysis

Option-by-option breakdown

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

  • ✗

    DEPLOY_ENV=staging

    Why it's wrong here

    This assigns the value only to a shell variable, which is not automatically part of the environment passed to child processes. While the current shell can read it, commands launched from this shell will not see DEPLOY_ENV unless it is explicitly exported. It does not satisfy the requirement that child processes can read the value.

  • ✗

    set DEPLOY_ENV=staging

    Why it's wrong here

    In Bash, set is used to set or unset shell options and positional parameters, not to assign arbitrary variable values. Writing set DEPLOY_ENV=staging would treat the string as a positional parameter or produce unexpected behavior; it does not create an environment variable that child processes can read.

  • ✓

    export DEPLOY_ENV=staging

    Why this is correct

    The export builtin marks the variable for inclusion in the environment of subsequently executed commands. Combining assignment and export in one statement sets the value and makes it available to child processes, exactly matching the scenario's requirement that child processes can read DEPLOY_ENV in the current session.

  • ✗

    env DEPLOY_ENV=staging

    Why it's wrong here

    The env command runs a program with a modified environment, but without a command argument it merely prints the environment. It does not modify the current shell's variables or export anything to future child processes. This leaves the current session unchanged and fails the requirement.

About these practice questions

One of 402 original LPIC-1 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official LPI exam blueprint

This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.