nerdexam
LPI

010-150 · Question #81

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

The correct answer is A. export. The export command promotes a shell variable to an environment variable, making it available to child processes spawned from the current shell.

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

(31 responses)
  • A
    77% (24)
  • C
    6% (2)
  • D
    13% (4)
  • E
    3% (1)

Why each option

The export command promotes a shell variable to an environment variable, making it available to child processes spawned from the current shell.

AexportCorrect

The export built-in command marks a variable for export to the environment of subsequently executed commands. Without export, a variable is local to the current shell and child processes cannot see it. Running 'export VARNAME' or 'export VARNAME=value' adds it to the environment inherited by subprocesses.

Bannounce

announce is not a valid shell built-in or standard Unix command.

Cenv

env is used to print the current environment or run a command in a modified environment, not to promote a variable from the current shell session.

Dtransfer

transfer is not a valid shell built-in or standard Unix command.

Emv

mv is the move/rename command for files and directories, unrelated to shell variables.

Concept tested: Shell variable export to child process environment

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

Topics

#export command#environment variables#shell variables#variable scope

Community Discussion

No community discussion yet for this question.

Full 010-150 Practice