Linux_FoundationLinux_Foundation
LFCS · Question #115
LFCS Question #115: Real Exam Question with Answer & Explanation
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
Explanation
The export command makes a shell variable visible and accessible to subshells or child processes.
Common mistakes.
- A.
export $VARIABLEis 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. - C.
set $VARIABLEsets the shell's positional parameters to the words contained in the variable's value and does not export variables to subshells. - D.
set VARIABLEsimply displays shell variables or sets shell options, it does not export variables to subshells. - E.
env VARIABLE(if VARIABLE is a value) orenv -i VARIABLE=VALUE commandruns 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)
Reference. 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.