LX0-103 · Question #133
What is the purpose of the Bash built-in export command?
The correct answer is D. It sets up environment variables for applications.. The Bash built-in export command marks a shell variable so it is inherited by child processes as an environment variable.
Question
What is the purpose of the Bash built-in export command?
Options
- AIt allows disks to be mounted remotely.
- BIt runs a command as a process in a subshell.
- CIt makes the command history available to subshells.
- DIt sets up environment variables for applications.
- EIt shares NFS partitions for use by other systems on the network.
How the community answered
(28 responses)- A4% (1)
- D96% (27)
Why each option
The Bash built-in export command marks a shell variable so it is inherited by child processes as an environment variable.
Remote disk mounting is handled by commands like mount with NFS/CIFS options or by entries in /etc/fstab, not by export.
Running a command in a subshell is done with parentheses () or explicitly with bash -c, not with export.
Command history is managed by the shell's history facility (HISTFILE, history command); export does not affect history availability in subshells.
When a variable is declared in a shell, it exists only in that shell's scope by default. Using export promotes the variable into the environment, making it visible to any child process or application launched from that shell. This is the standard mechanism for passing configuration such as PATH, HOME, or custom variables to programs.
Sharing NFS partitions is configured via /etc/exports and managed by the nfs-server daemon, which is unrelated to the export built-in.
Concept tested: Bash export command and environment variables
Source: https://www.gnu.org/software/bash/manual/bash.html#index-export
Topics
Community Discussion
No community discussion yet for this question.