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.
set APP_MODEIncorrect. 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.
export APP_MODECorrect. 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
- Use disposable shell sessions and harmless commands for experiments.
- Shell behavior can depend on Bash options and distribution defaults.
Foundation review
Place the operation
Exporting changes inheritance metadata while preserving the variable's current value.
Check the side effect
Start a child shell and inspect the variable there; changes made by the child do not flow back.