nerdexam
LPI

010-100 · Question #17

Which command is used to make a shell variable known to subsequently executed programs?

The correct answer is A. export. The export builtin makes a shell variable part of the environment so child processes can access it.

The Power of the Command Line

Question

Which command is used to make a shell variable known to subsequently executed programs?

Options

  • Aexport
  • Bannounce
  • Cenv
  • Dtransfer
  • Emv

How the community answered

(40 responses)
  • A
    73% (29)
  • B
    3% (1)
  • C
    8% (3)
  • D
    15% (6)
  • E
    3% (1)

Why each option

The export builtin makes a shell variable part of the environment so child processes can access it.

AexportCorrect

The export command in POSIX-compliant shells adds a variable to the shell's export list, causing it to be inherited by all subsequently executed child processes as an environment variable. Without export, a variable exists only in the current shell's local scope and is invisible to any subprocess or program launched from that shell. This is the standard mechanism for passing configuration values such as PATH or custom settings to programs invoked from a shell session.

Bannounce

announce is not a valid shell command or Unix utility and does not exist in standard shell environments.

Cenv

env can display the current environment or run a program with a modified environment, but it does not mark a shell variable for automatic inheritance by future child processes.

Dtransfer

transfer is not a valid shell command or Unix utility.

Emv

mv is a filesystem utility that moves or renames files and directories and has no relationship to variable scope or environment inheritance.

Concept tested: Exporting shell variables to child processes

Source: https://www.gnu.org/software/bash/manual/bash.html#index-export

Topics

#export command#shell variables#environment variables#subprocesses

Community Discussion

No community discussion yet for this question.

Full 010-100 Practice