nerdexam
Linux_Foundation

LFCS · Question #448

Which of the following commands allows an administrator to make a shell variable visible to subshells?

The correct answer is B. export VARIABLE. The export command is used to make a shell variable an environment variable, ensuring that it is inherited and visible to any subshells or child processes.

Submitted by anjalisingh· Apr 18, 2026Essential Commands

Question

Which of the following commands allows an administrator to make a shell variable visible to subshells?

Options

  • Aexport $VARIABLE
  • Bexport VARIABLE
  • Cset $VARIABLE
  • Dset VARIABLE
  • Eenv VARIABLE

How the community answered

(48 responses)
  • A
    2% (1)
  • B
    94% (45)
  • C
    4% (2)

Why each option

The `export` command is used to make a shell variable an environment variable, ensuring that it is inherited and visible to any subshells or child processes.

Aexport $VARIABLE

`export $VARIABLE` attempts to export the *value* of the variable as a new variable name, which is syntactically incorrect for exporting the variable itself.

Bexport VARIABLECorrect

The `export VARIABLE` command explicitly marks a shell variable named `VARIABLE` for export, making it an environment variable that will be visible and accessible to any subshells or child processes subsequently created from the current shell.

Cset $VARIABLE

`set $VARIABLE` would attempt to set shell options or positional parameters based on the variable's value and does not make a variable visible to subshells.

Dset VARIABLE

`set VARIABLE` would either set shell options if `VARIABLE` is a valid option or treat `VARIABLE` as a positional parameter, neither of which exports the variable.

Eenv VARIABLE

`env VARIABLE` would attempt to execute a command named `VARIABLE` within a new environment, or display the current environment, but it does not export a shell variable from the current shell.

Concept tested: Exporting shell variables

Source: https://man7.org/linux/man-pages/man1/bash.1.html

Topics

#Shell variables#export command#Subshells#Environment variables

Community Discussion

No community discussion yet for this question.

Full LFCS Practice