nerdexam
CompTIA

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.

GNU and Unix Commands

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)
  • A
    4% (1)
  • D
    96% (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.

AIt allows disks to be mounted remotely.

Remote disk mounting is handled by commands like mount with NFS/CIFS options or by entries in /etc/fstab, not by export.

BIt runs a command as a process in a subshell.

Running a command in a subshell is done with parentheses () or explicitly with bash -c, not with export.

CIt makes the command history available to subshells.

Command history is managed by the shell's history facility (HISTFILE, history command); export does not affect history availability in subshells.

DIt sets up environment variables for applications.Correct

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.

EIt shares NFS partitions for use by other systems on the network.

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

#export command#environment variables#bash built-ins#shell environment

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice