nerdexam
Linux_Foundation

LFCS · Question #115

Which command makes the shell variable named VARIABLE visible to subshells?

The correct answer is B. export VARIABLE. The export command makes a shell variable visible and accessible to subshells or child processes.

Submitted by fatema_kw· Apr 18, 2026Essential Commands

Question

Which command makes the shell variable named VARIABLE visible to subshells?

Options

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

How the community answered

(17 responses)
  • A
    6% (1)
  • B
    88% (15)
  • E
    6% (1)

Why each option

The `export` command makes a shell variable visible and accessible to subshells or child processes.

Aexport $VARIABLE

`export $VARIABLE` is syntactically incorrect for exporting a variable; it attempts to use the *value* of the variable as the name of the variable to be exported, which will fail or produce an unintended result.

Bexport VARIABLECorrect

The `export VARIABLE` command marks the specified shell variable to be placed in the environment of any child processes that are subsequently created from the current shell, thus making it visible to subshells.

Cset $VARIABLE

`set $VARIABLE` sets the shell's positional parameters to the words contained in the variable's value and does not export variables to subshells.

Dset VARIABLE

`set VARIABLE` simply displays shell variables or sets shell options, it does not export variables to subshells.

Eenv VARIABLE

`env VARIABLE` (if VARIABLE is a value) or `env -i VARIABLE=VALUE command` runs a command with a modified environment or displays environment variables, but it does not export the variable from the current shell for general subshell inheritance.

Concept tested: Shell variable export (`export`)

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

Topics

#shell variables#environment variables#export command#subshells

Community Discussion

No community discussion yet for this question.

Full LFCS Practice