Bird
0
0

Which command correctly does this?

hard📝 Application Q15 of 15
Linux CLI - Environment and Configuration
You want to create a script that sets a temporary environment variable TEMP_VAR only for a single command execution, without affecting the shell's environment afterwards. Which command correctly does this?
ATEMP_VAR=value command
Bexport TEMP_VAR=value; command
Cset TEMP_VAR=value command
Dcommand; export TEMP_VAR=value
Step-by-Step Solution
Solution:
  1. Step 1: Understand temporary environment variables for one command

    Setting a variable before a command like TEMP_VAR=value command runs the command with that variable set only for its execution.
  2. Step 2: Evaluate each option

    export TEMP_VAR=value; command exports variable globally; set TEMP_VAR=value command uses invalid syntax; command; export TEMP_VAR=value sets variable after command runs.
  3. Final Answer:

    TEMP_VAR=value command -> Option A
  4. Quick Check:

    Prefix variable before command for temporary env [OK]
Quick Trick: Put variable before command to set it temporarily [OK]
Common Mistakes:
  • Using export which affects shell permanently
  • Trying to set variable after command runs
  • Using incorrect syntax like 'set' for env variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes