200-901 · Question #322
A developer is running an application that connects to the Cisco website and collects data. The application will be hosted in a local data center and the data will need to be collected on a frequent…
The correct answer is D. export website="cisco.com". To make a shell variable accessible to child processes as an environment variable in a Linux system, the Bash export command is used.
Question
A developer is running an application that connects to the Cisco website and collects data. The application will be hosted in a local data center and the data will need to be collected on a frequent basis. The application client requires certain environmental variables to be set before the run. Which Bash command sets the environmental variables for a Linux system? A. B. C. D.
Options
- A"cisco.com"=WEBSITE
- Bexport lvar=23
- CWEBSITE="cisco.com"
- Dexport website="cisco.com"
How the community answered
(26 responses)- B4% (1)
- C4% (1)
- D92% (24)
Why each option
To make a shell variable accessible to child processes as an environment variable in a Linux system, the Bash `export` command is used.
`"cisco.com"=WEBSITE` is incorrect syntax for assigning a value to a variable in Bash; the variable name must come first.
`export lvar=23` correctly sets and exports an environment variable, but it uses the wrong variable name and value for the scenario described.
`WEBSITE="cisco.com"` correctly assigns a value to a shell variable, but without the `export` command, this variable would not be available in the environment of child processes.
The `export` command in Bash is specifically used to mark a variable so that it becomes part of the environment passed to child processes. This makes `website="cisco.com"` available to the application when it runs, fulfilling the requirement for setting environmental variables.
Concept tested: Bash environment variables with export
Source: https://www.gnu.org/software/bash/manual/bash.html#index-export
Topics
Community Discussion
No community discussion yet for this question.