Which command allows you to make a shell variable visible to subshells?
A . export $VARIABLE
B . export VARIABLE
C . set $VARIABLE
D . set VARIABLE
E . env VARIABLE
Answer: B
Explanation:
The command that allows you to make a shell variable visible to subshells is export VARIABLE. This command turns the variable into a global or environment variable, which means it can be accessed by any child process or subshell that inherits the environment of the parent shell. The syntax of the export command does not require a dollar sign ($) before the variable name, unlike when referencing the value of the variable. The other commands are either invalid or do not affect the visibility of the variable to subshells. The set command can be used to assign values to variables, but it does not export them. The env command can be used to run a command in a modified
environment, but it does not change the environment of the current shell.
Reference: [LPI Linux Essentials – Topic 105: Shells, Scripting and Data Management]
[LPI Linux Professional – Exam 102 Objectives – Topic 105: Shells and Shell Scripting] What is a Subshell? – Linux Bash Shell Scripting Tutorial Wiki – nixCraft What is Subshell in Linux? [Explained]
Latest 102-500 Dumps Valid Version with 194 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund