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.
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)- A77% (24)
- C6% (2)
- D13% (4)
- E3% (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.
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.
announce is not a valid shell built-in or standard Unix command.
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.
transfer is not a valid shell built-in or standard Unix command.
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
Community Discussion
No community discussion yet for this question.