APP_MODE=testing exists in the current Bash but is not exported.
Make it visible to subsequently started child processes without changing its value.
Which command should be added?
export NAME marks the existing shell variable for inclusion in the environment inherited by child processes.
Detailed explanation
echo APP_MODEIncorrect. echo only prints text.
Incorrect. echo only prints text.
set APP_MODEIncorrect. set does not add the export attribute.
Incorrect. set does not add the export attribute.
env APP_MODEIncorrect. env displays or runs with an environment but does not export the existing shell variable this way.
Incorrect. env displays or runs with an environment but does not export the existing shell variable this way.
export APP_MODECorrect. export APP_MODE makes the existing value part of child environments.
Correct. export APP_MODE makes the existing value part of child environments.
Try it yourself
An example you can run in a temporary verification environment.
APP_MODE=testing; export APP_MODE; bash -c 'printf "%s\n" "$APP_MODE"'Expected result
testingKey points
- export exposes to environment
- The value stays unchanged
- Children do not update the parent
Notes
- Environment: Bash 5.x / 子Bash
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.